I have a custom directive called my-directive which is of attribute type (restrict: 'A'). I use it as follows:
<input my-directive="mydvalue"/>
How do i get the "mydvalue" inside the directive?
app.directive("myDirective", function (){
return {
restrict: 'A',
link: function(scope, el, attrs, controller) {
//How do i get the mydvalue here.
}
};
});
Just attrs.myDirective
In attrs you have all the attributes of the element and a awesome ngModel too :) !
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments