Hello
 
please refer below articles :
 
http://adrianmejia.com/blog/2016/04/08/creating-custom-angularjs-directives-for-beginners/
 
https://www.3pillarglobal.com/insights/angularjs-understanding-custom-directive
 
thanks