Implementing inheritance in AngularJS directives
You could use the attrs
params of the link function to get the type of each directive. Take a look at the code below and check your console. (http://jsbin.com/oZAHacA/2/)
<html ng-app="myApp"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script> <script> var myApp = angular.module('myApp', []); myApp.directive('controlInput', [function () { return { restrict: 'E', link: function (scope, iElement, iAttrs) { console.log(iAttrs.type); } }; }]); </script> </head> <body> <control-input type="text" name="vendor_name"></control-input> </body></html>