Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 74014f5

Browse files
committed
docs(filters): update examples to use modules
1 parent 0cddc5c commit 74014f5

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/ng/filter/filters.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
*
1616
*
1717
* @example
18-
<example>
18+
<example module="currencyExample">
1919
<file name="index.html">
2020
<script>
21-
function Ctrl($scope) {
22-
$scope.amount = 1234.56;
23-
}
21+
angular.module('currencyExample', [])
22+
.controller('ExampleController', ['$scope', function($scope) {
23+
$scope.amount = 1234.56;
24+
}]);
2425
</script>
25-
<div ng-controller="Ctrl">
26+
<div ng-controller="ExampleController">
2627
<input type="number" ng-model="amount"> <br>
2728
default currency symbol ($): <span id="currency-default">{{amount | currency}}</span><br>
2829
custom currency identifier (USD$): <span>{{amount | currency:"USD$"}}</span>
@@ -74,14 +75,15 @@ function currencyFilter($locale) {
7475
* @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit.
7576
*
7677
* @example
77-
<example>
78+
<example module="numberFilterExample">
7879
<file name="index.html">
7980
<script>
80-
function Ctrl($scope) {
81-
$scope.val = 1234.56789;
82-
}
81+
angular.module('numberFilterExample', [])
82+
.controller('ExampleController', ['$scope', function($scope) {
83+
$scope.val = 1234.56789;
84+
}]);
8385
</script>
84-
<div ng-controller="Ctrl">
86+
<div ng-controller="ExampleController">
8587
Enter number: <input ng-model='val'><br>
8688
Default formatting: <span id='number-default'>{{val | number}}</span><br>
8789
No fractions: <span>{{val | number:0}}</span><br>

0 commit comments

Comments
 (0)