Reputation: 646
Let's say we have some form
<form name="myForm" data-ng-controller="Ctrl">
<input name="input" data-ng-model="userType" data-description="User Type" required>
</form>
In controller, we can access that input element by code
$scope.myForm.userType
But how can we get data-* attributes of this element?
Upvotes: 4
Views: 1807
Reputation: 3476
You can use:
angular.element(selector).attr("data-description")
to select elements as you would do with jQuery.
Upvotes: 5