Javascript function to return true/false.
$scope.createDisabled = false;
function isEnabled() {
if ($scope.node.activationStatus == "Y") {
$scope.createDisabled = true;
}
else {
$scope.createDisabled = false;
}
}
HTML
<stx-action-create disabled="createDisabled"></stx-action-create>
The result that was returned to the view was false and it did not change according to the condition.
There can be three cases:
stx-action-center
disabled attribute just call the isEnabled
function and return the Boolean from the function(skip $scope) I think you are not invoking the function you created.
Please make changes
to your html as shown below.
<stx-action-create disabled="isEnabled()"></stx-action-create>
Changes in JavaScript
$scope.createDisabled = false; // Not sure if this is necessary
$scope.isEnabled = function () { // Make the method available on $scope
return ($scope.node.activationStatus == "Y");
}
Changes in HTML
<stx-action-create disabled="isEnabled()"></stx-action-create>
This should solve the problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.