Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pocesar/angular-onfinish
Directives that execute a function or an expression when ng-repeat is done with looping. No need for events.
https://github.com/pocesar/angular-onfinish
Last synced: 17 days ago
JSON representation
Directives that execute a function or an expression when ng-repeat is done with looping. No need for events.
- Host: GitHub
- URL: https://github.com/pocesar/angular-onfinish
- Owner: pocesar
- License: mit
- Created: 2013-11-06T17:26:50.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-11-07T13:59:05.000Z (about 11 years ago)
- Last Synced: 2024-10-18T06:28:40.630Z (27 days ago)
- Language: JavaScript
- Homepage:
- Size: 109 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
angular-onfinish
================Directives that execute a function or an expression when ng-repeat is done with looping. No need for events.
## Usage
#### Include it in your app:
```js
var yourapp = angular.module('yourapp', ['onfinish']);
```#### In your HTML, set the `on-finish` attribute:
```html
```
#### Make sure your scope has the variables / functions:
```js
App.controller('MyCtrl', function(){
$scope.finished = function(){
console.log('done looping');
};
$scope.list = ['yaba', 'daba', 'doo'];
$scope.items = [
{id: 1},
{id: 2},
{id: 3}
];
$scope.done = false;
});
```
#### Have fun
## Notes
* Expressions are evaluated inside the `on-finish=""`, so you cannot use `$scope` variables there
* There are no modifications on the original `$scope`, it's the exact same `$scope` that you have inside your `ng-repeat` directive (same IDs, variables, etc)
* The code is evaluated BEFORE the browser render the DOM elements. Be aware of it. If you must, place in your `finished` function a `$timeout` with the 3rd parameter as `false`, so it won't trigger another `$digest` cycle