is possible capture single word property (one without value) in angularjs directive tag, instead of requiring value assigned it, , have value available in controller
?
for example:
<my-input type="radio" checked></my-input>
... instead of requiring checked="true"
typed.
there solution accessing these values in link
of directive (attribute without value in angularjs directive), unclear me how can gain access these values in controller.
you can use attrs in controller way can in scope.
app.directive('myinput', [function () { return { restrict: 'e', controller: function($scope,$element,$attrs){ } }; }]);
look @ the $compile/directive definition object official doc, scroll down section on controller constructor function.
the controller injectable (and supports bracket notation) following locals:
$scope - current scope associated element
$element - current element
$attrs - current attributes object element
$transclude - transclude linking function pre-bound correct transclusion scope
Comments
Post a Comment