mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-09 22:39:39 +08:00
docs(filters): update examples to use modules
This commit is contained in:
@@ -15,14 +15,15 @@
|
||||
*
|
||||
*
|
||||
* @example
|
||||
<example>
|
||||
<example module="currencyExample">
|
||||
<file name="index.html">
|
||||
<script>
|
||||
function Ctrl($scope) {
|
||||
$scope.amount = 1234.56;
|
||||
}
|
||||
angular.module('currencyExample', [])
|
||||
.controller('ExampleController', ['$scope', function($scope) {
|
||||
$scope.amount = 1234.56;
|
||||
}]);
|
||||
</script>
|
||||
<div ng-controller="Ctrl">
|
||||
<div ng-controller="ExampleController">
|
||||
<input type="number" ng-model="amount"> <br>
|
||||
default currency symbol ($): <span id="currency-default">{{amount | currency}}</span><br>
|
||||
custom currency identifier (USD$): <span>{{amount | currency:"USD$"}}</span>
|
||||
@@ -74,14 +75,15 @@ function currencyFilter($locale) {
|
||||
* @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit.
|
||||
*
|
||||
* @example
|
||||
<example>
|
||||
<example module="numberFilterExample">
|
||||
<file name="index.html">
|
||||
<script>
|
||||
function Ctrl($scope) {
|
||||
$scope.val = 1234.56789;
|
||||
}
|
||||
angular.module('numberFilterExample', [])
|
||||
.controller('ExampleController', ['$scope', function($scope) {
|
||||
$scope.val = 1234.56789;
|
||||
}]);
|
||||
</script>
|
||||
<div ng-controller="Ctrl">
|
||||
<div ng-controller="ExampleController">
|
||||
Enter number: <input ng-model='val'><br>
|
||||
Default formatting: <span id='number-default'>{{val | number}}</span><br>
|
||||
No fractions: <span>{{val | number:0}}</span><br>
|
||||
|
||||
Reference in New Issue
Block a user