AngularJs: How to get the attribute value of a attribute type directive

Vijey

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.

      }

  };

});
Thomas Pons

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

AngularJs: How to get the attribute value of a attribute type directive

From Dev

How to get attribute value in template in angularjs custom directive?

From Dev

Get value of attribute in Angularjs custom directive

From Dev

Get value of attribute in Angularjs custom directive

From Dev

Angular element directive how to get attribute value

From Dev

Attribute without value in AngularJS directive

From Dev

How to bind an attribute in a AngularJS directive?

From Dev

AngularJS: How to monitor an attribute in a directive?

From Dev

How can I get pass value from controller back to directive's template attribute in AngularJS?

From Dev

How can I get pass value from controller back to directive's template attribute in AngularJS?

From Dev

How to create a Attribute Directive to insert another attribute directive in a element in AngularJS

From Dev

AngularJS directive: switch statement depending on attribute value

From Dev

AngularJS directive attribute not rendering value when observed

From Dev

Using attribute text value in AngularJS directive

From Dev

AngularJS directive: switch statement depending on attribute value

From Dev

AngularJS - Getting an attribute value from a directive

From Dev

How to get and run an attribute of value "{{aaa}}/{{bbb}}" in a directive?

From Dev

how to get the attribute value defined in html file of template url in directive

From Dev

How to get and run an attribute of value "{{aaa}}/{{bbb}}" in a directive?

From Dev

AngularJS Get Only Directive Attribute Names That Interpolates

From Dev

AngularJS Directive: Get Object from Attribute

From Dev

Default Content Type Attribute value for Page Directive

From Dev

Attribute directive in AngularJS

From Dev

How to conditionally apply attribute in angularJS directive?

From Dev

How do you 'require' an attribute on an angularjs directive?

From Dev

AngularJS: How to set an attribute to a custom directive

From Dev

Angularjs directive: how to pass an array via attribute?

From Dev

How to conditionally apply attribute in angularJS directive?

From Dev

AngularJS: Difference between Custom directive type Attribute and type Element

Related Related

  1. 1

    AngularJs: How to get the attribute value of a attribute type directive

  2. 2

    How to get attribute value in template in angularjs custom directive?

  3. 3

    Get value of attribute in Angularjs custom directive

  4. 4

    Get value of attribute in Angularjs custom directive

  5. 5

    Angular element directive how to get attribute value

  6. 6

    Attribute without value in AngularJS directive

  7. 7

    How to bind an attribute in a AngularJS directive?

  8. 8

    AngularJS: How to monitor an attribute in a directive?

  9. 9

    How can I get pass value from controller back to directive's template attribute in AngularJS?

  10. 10

    How can I get pass value from controller back to directive's template attribute in AngularJS?

  11. 11

    How to create a Attribute Directive to insert another attribute directive in a element in AngularJS

  12. 12

    AngularJS directive: switch statement depending on attribute value

  13. 13

    AngularJS directive attribute not rendering value when observed

  14. 14

    Using attribute text value in AngularJS directive

  15. 15

    AngularJS directive: switch statement depending on attribute value

  16. 16

    AngularJS - Getting an attribute value from a directive

  17. 17

    How to get and run an attribute of value "{{aaa}}/{{bbb}}" in a directive?

  18. 18

    how to get the attribute value defined in html file of template url in directive

  19. 19

    How to get and run an attribute of value "{{aaa}}/{{bbb}}" in a directive?

  20. 20

    AngularJS Get Only Directive Attribute Names That Interpolates

  21. 21

    AngularJS Directive: Get Object from Attribute

  22. 22

    Default Content Type Attribute value for Page Directive

  23. 23

    Attribute directive in AngularJS

  24. 24

    How to conditionally apply attribute in angularJS directive?

  25. 25

    How do you 'require' an attribute on an angularjs directive?

  26. 26

    AngularJS: How to set an attribute to a custom directive

  27. 27

    Angularjs directive: how to pass an array via attribute?

  28. 28

    How to conditionally apply attribute in angularJS directive?

  29. 29

    AngularJS: Difference between Custom directive type Attribute and type Element

HotTag

Archive