When to use a filter vs a directive in Angularjs

前端 未结 3 1086
野的像风
野的像风 2021-02-05 10:37

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

3条回答
  •  我寻月下人不归
    2021-02-05 11:00

    One more point I want to add apart from

    1. Filter for general Data filtering / transformation
    2. Directive for DOM Manipulation / UI behavior

    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.

提交回复
热议问题