docs(limitTo): update example to use a module

This commit is contained in:
Brian Ford
2014-07-07 23:39:52 -07:00
parent 9f5be534fc
commit 18d18f07db
+9 -8
View File
@@ -19,17 +19,18 @@
* had less than `limit` elements.
*
* @example
<example>
<example module="limitToExample">
<file name="index.html">
<script>
function Ctrl($scope) {
$scope.numbers = [1,2,3,4,5,6,7,8,9];
$scope.letters = "abcdefghi";
$scope.numLimit = 3;
$scope.letterLimit = 3;
}
angular.module('limitToExample', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.numbers = [1,2,3,4,5,6,7,8,9];
$scope.letters = "abcdefghi";
$scope.numLimit = 3;
$scope.letterLimit = 3;
}]);
</script>
<div ng-controller="Ctrl">
<div ng-controller="ExampleController">
Limit {{numbers}} to: <input type="integer" ng-model="numLimit">
<p>Output numbers: {{ numbers | limitTo:numLimit }}</p>
Limit {{letters}} to: <input type="integer" ng-model="letterLimit">