Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF in JavaScript
Message
From
05/08/2014 13:14:57
 
General information
Forum:
Javascript
Category:
Other
Miscellaneous
Thread ID:
01605133
Message ID:
01605181
Views:
35
>I am having troubles with disable-action.
>
>I want to set it to the variable.
>
>Here is what I get when I inspect the element. The button is not disabled and I want it disabled:
>
>
><a class="btn btn-default ng-isolate-scope ng-binding" ng-click="click()" ok-action="clearEMessage()" 
>disable-action="disableClearMessage" 
>link-text="Clear E-Messages" cancel-label="No" ok-label="Yes" 
>confirm-message="'Are you sure you want to clear all e-messages?'" 
>confirm-title="Confirm Clear" ng-disabled="true">Clear E-Messages</a>
>
>I changed the directive this way:
>
>
>app.directive('confirmButton', [function() {
>        return {
>            restrict: 'AE',
>            transclude: true,
>            replace: true,
>            scope: {
>                linkText: '@',
>                okLabel: '@',
>                cancelLabel: '@?',
>                confirmTitle: '@',
>                confirmMessage: '=',
>                onOpen: '&',
>                okAction: '&',
>                disableAction: '='
>            },
>            controller: ['$scope', '$modal', function($scope, $modal) {
>                $scope.okClass = 'btn-danger';
>                $scope.message = $scope.confirmMessage;
>                $scope.title = $scope.confirmTitle;
>                //      $scope.okLabel = $scope.okLabel;
>         //       console.log('Before: ' + $scope.cancelLabel);
>                $scope.cancelLabel = $scope.cancelLabel || 'Cancel';
>         //       console.log('After: ' + $scope.cancelLabel);
>
>                $scope.click = function () {
>                  
>                    if ($scope.onOpen) {
>                        $scope.onOpen();
>                    }
>                    var modal = $modal.open({
>                        scope: $scope,
>                        templateUrl: '/app/templates/modal.html'
>                    });
>
>                    modal.result.then(function (result) {
>                        $scope.okAction();
>                    });
>                };
>            }],
>            template: '<a ng-click="click()" ng-disabled=" {{ disableAction }} " >{{ linkText }}</a>'
>        };
>    }]);
>
>So, now it evaluates the disableAction. The disable-action I set to the name of the variable disableClearMessage and this variable is true when I open that form. So, the button should be disabled (and ng-disabled = 'true') as you see.

Don't get it. 'disable-action="disableClearMessage" ' is setting the value to a string. How does it get to a bool ?


>
>However, the button is not disabled and I can click on it just fine and the click event works. It may be a minor problem since the only reason I want to disable the button if there is nothing to clear (the message is empty anyway).
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform