Directives are markers on a DOM element that tell AngularJS to attach a specified behavior to that DOM element or even transform the DOM element and its children.

There are many jQuery plugins which we often need in angularjs  , I was using image slider plugin  http://pgwjs.com/pgwslider/

in my project which I am discussing here. One of the  classical way of plugin initialization is

which should not use in  angular so there are different ways we can initialize the plugin in  angularjs

First one via   $viewContentLoaded:  this event is emitted every time the ngView content is reloaded and should provide similar functionality as the document.ready when routing in angularjs

In this case you may need a timeout function.

And the another way using Directive:

And then we need to put the name of this directive on the html element where we need to use the plugin.