What is the difference between directives and services?

Services are one of the ways to communicate with controllers, but it is possible to inject one service into another. Services can be used for doing other things like authentication and logging. It is one of the most common Angularjs Interview Questions.

Directives are for creating widgets or wrapping things like jquery plugins. However, if you do not need two-way data binding, then you do not need to wrap them.

Suggest An Answer

No suggestions avaliable!

Related Interview Questions