AngularJS filters are used to format/transform the data displayed in the
view, filters can be used with expressions, ng-bind, ng-repeat etc and act upon
the data from the model. In the previous posts we have seen on how to create
and invoke custom filters from the
view, in this post we shall see on how to create custom filters and invoke them
from the controller functions in JavaScript.
Showing posts with label Custom Filters. Show all posts
Showing posts with label Custom Filters. Show all posts
Thursday, July 2, 2015
AngularJS Custom Filters
AngularJS filters are used to format/transform the data displayed in the
view, filters can be used with expressions, ng-bind, ng-repeat etc and act upon
the data from the model. In the previous posts we have seen some of the key
pre-defined filters, we can also create our own custom filter and use them as appropriate. In this post we shall
see on how to create and use a custom filter.
Custom filters can be defined by configuring them in the application module, we will have to define a filter function, the function implementation should script the expected functionality from the filter.
The following is an example of a simple custom filter which prefix the word ‘Hello’ to any text which is annotated with the custom filter.
Custom filters can be defined by configuring them in the application module, we will have to define a filter function, the function implementation should script the expected functionality from the filter.
The following is an example of a simple custom filter which prefix the word ‘Hello’ to any text which is annotated with the custom filter.
Subscribe to:
Posts (Atom)