A few days ago I needed to create a custom filter to truncate a piece of text with a specific length and with a custom ending, something like this: "This is an Examp...".
Before I continue, I want to refer that AngularJS is on version 1.0. At this version the documentation is not yet completed.
The creation of custom filters only needs three things:
- Create the module
- Create the filter and his function
- Register the module in the application
1. Create the module
2. Create the filter and his function
3. Register the module in the application
Example: Truncate Filter
Note: This can not be the best practice implementation, but was the result I achieved and solved my problem.