An open API service indexing awesome lists of open source software.

https://github.com/chrisyip/ng-partialize


https://github.com/chrisyip/ng-partialize

Last synced: 9 months ago
JSON representation

Awesome Lists containing this project

README

          

# ng-partialize

Example:

Common logic (`common.js`) :

```js
angular.module('myApp', [])
.controller('demoCtrl', function ($scope) {
$scope.query(function (items) {
$scope.items = items

$scope.pagination = {
count: items.length,
total: getTotal()
}
})

$scope.onClick = function (item) {
$scope.showDetail(item)
}
})
```

Web app A:

```html

<script src="ng-partialize.js"

<script src="list.js"




```

`list.js`:

```js
angular.module('myApp')
.beforeController('demoCtrl', function ($scope, List) {
$scope.query = function (cb) {
return List.query(cb)
}

$scope.showDetail = function () { /* do something */ }
})
.afterController('demoCtrl', function ($scope) {
$scope.$watch('items', function (val) {
if (val) {
$scope.list = val.map(function (item) { /* do something */ })
}
})
})
```

Web app B:

```html

<script src="ng-partialize.js"

<script src="article.js"

```

`article.js`:

```js
angular.module('myApp')
.beforeController('demoCtrl', function ($scope, Article) {
$scope.query = function (cb) {
return Article.query(cb)
}

$scope.showDetail = function () { /* do something */ }
})
.afterController('demoCtrl', function ($scope) {
$scope.$watch('items', function (val) {
if (val) {
$scope.articles = val.map(function (item) { /* do something */ })
}
})
})
```

# Author

[Chris Yip](https://github.com/chrisyip)