angular-ui / ui-ace

This directive allows you to add ACE editor elements.
http://angular-ui.github.io/ui-ace
MIT License
578 stars 172 forks source link

align boolean checking with Angular #95

Closed rebornix closed 9 years ago

rebornix commented 9 years ago

As we know in Angular built-in directives ngIf and ngShowHide, they simply use if expression to check boolean like below:

$scope.$watch($attr.ngIf, function ngIfWatchAction(value) {
    if (value) {
    }
    else {
    }

in which case, '' would be regarded as FALSE. As ui-ace is yet another Angular directive, users are likely to think the behavior in <ui-ace readonly="""> is totally the same as <div ng-if=""></div>. But for now it's not, we would treat empty string as TRUE.

I suppose we can just use !!value to check boolean.

rebornix commented 9 years ago

racall this PR as we actually has ng-readonly to handle all Angular expressions, this PR does not make any sense.