2015-04-09 23:11:56 +02:00
|
|
|
# .cadoles-slide-title[Les filtres (2/3)]
|
2015-04-09 20:36:17 +02:00
|
|
|
|
|
|
|
**Exemple d'usage dans un contrôleur**
|
|
|
|
```js
|
|
|
|
angular.module('myApp', [])
|
|
|
|
.controller('MyCtrl', ['$scope', '$filter', function($scope, $filter) {
|
|
|
|
|
|
|
|
var myArr = ['item 1', 'item 2', 'item 3'];
|
|
|
|
|
|
|
|
// Usage: result = $filter(filterId, input, arg1, arg2, ...);
|
|
|
|
|
|
|
|
console.log( $filter('limitTo', myArr, 2) ); // -> ['item 1', 'item 2']
|
|
|
|
|
|
|
|
}])
|
|
|
|
;
|
|
|
|
```
|