It\'s a simple question - and it may have been asked (just couldn\'t find it..)
When would you use a filter over a directive when it comes to manipulating the data, or v
One more point I want to add apart from
Generally we use filters for an array of data.
I feel like there is no logical difference between them. Both does the same job. It is usage which is different.
Some hints (non-exhaustive lists):
Use it when...
require
configuration of the directive)Use it when...
filter
filter and ng-repeat
)Filter for general Data filtering / transformation
Directive for DOM Manipulation / UI behavior
In your case you can write it like so:
<div>{{ testMessage + ' result' }}</div>