html - angular - access the element from ng-disabled -


i want pass this (the element) - button controller ng-disable. here html:

<button type ="button" class = "btn btn-default" ng-click= "open()" ng-disabled = "checkrowid(this)"> </button> 

and controller :

$scope.checkrowid = function(btn){    console.log(btn); //undefined } 

the log shoes undefined, there way pass element button via ng-disabled?

there no direct way pass element via ng-disabled. can create 1 directive "disabled-ele" , put element disabling logic there.

example code:

.directive('disabledele', function() {                     return {                         restrict: 'ea',                         link: function(scope, element, attrs) {                             if(attrs.disabledele.tolowercase() === 'true') {                                 element.attr('disabled', 'disabled');                             } else {                                 element.removeattr('disabled');                             }                         }                     }                 });  <button type ="button" value="click" class = "btn btn-default" disabled-ele="false">click                     </button> 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -