We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I did this, though, and it worked fine. I looked up how here: https://docs.angularjs.org/guide/filter#using-filters-in-controllers-services-and-directives
<!-- index.html --> <div ng-controller="index"> <p>Value: <input type="text" ng-model="value" /></p> <p>{{ value | round:2 | dollars }}</p> <p>{{ testValue }}</p> </div>
// root.js angular.module("root", ["filters"]) .controller("index", ['$scope', "roundFilter", "dollarsFilter", function($scope, roundFilter, dollarsFilter) { $scope.testValue = ''; $scope.$watch('value', function (newValue, oldValue) { $scope.testValue = dollarsFilter(roundFilter(newValue, 2)); }); }]); // filters.js angular.module("filters", []) .filter("round", function () { return function(input, precision) { return input ? parseFloat(input).toFixed(precision) : ""; }; }) .filter("dollars", function () { return function(input) { return input ? "$" + input : ""; }; });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I did this, though, and it worked fine. I looked up how here: https://docs.angularjs.org/guide/filter#using-filters-in-controllers-services-and-directives
The text was updated successfully, but these errors were encountered: