I would like to pass w filter as a param to a custom directive in my app. I would like to do something like:
Usage in application:
<my-directive data='dataVariable' dataFilter='numericFilter: 123'/>
Directive template:
<span> {{ data | dataFilter }} </span>
Directive:
...
scope: {
data: '=',
dataFilter: '@'
}
...
When I do it as shwon above I get error related to syntax (: is not recognized), dependency injection (filter is not found) or the filter simply does nothing.
dataFilterattribute should bedata-filter. And how doesdataFilterattribute work within the directive? Show the contents of yourmy-directivedataFilteris not used inside the directive code. It is only needed to format HTML output.