Oops. Should have looked closer :-{
Try:
$scope.cancelLabel = !($scope.cancelLabel) ? 'Cancel' : $scope.cancelLabel;
or
$scope.cancelLabel = Boolean($scope.cancelLabel) ? $scope.cancelLabel : 'Cancel';
Update: Just saw your
$scope.cancelLabel = $scope.cancelLabel || 'Cancel';
which is the neatest option :-}
>No, my code doesn't work correctly. Here is my current codee
>
> console.log('Before: ' + $scope.cancelLabel);
> $scope.cancelLabel = (!$scope.cancelLabel) ? $scope.cancelLabel : 'Cancel';
> console.log('After: ' + $scope.cancelLabel);
>
>
>I can see that before is No and after is Cancel, so this code is not working.
>
>How can I check for that property being set as I need to use default value for the property?
>
>>>Hi everybody,
>>>
>>>Just want to confirm if the syntax I use is correct or not.
>>>
>>>I want to use the following code
>>>
>>>
>>>$scope.cancelLabel = (!cancelLabel) ? cancelLabel : 'Cancel';
>>>
>>>which translates into:
>>>
>>>if cancelLabel is not empty, use cancelLabel otherwise set it to 'Cancel'.
>>>
>>>First I want to verify if the test for not empty as !cancelLabel is correct and secondly, if IIF in JavaScript is written the way I did.
>>
>>Should be OK if you know that 'cancelLabel' has been declared and is a string. If not see 'ToBoolean' here:
http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf>>
>>>Thanks in advance.
>>>
>>>Also, the disableAction doesn't seem to work for me using this syntax:
>>>
>>>
>>><data-confirm:button class="btn btn-default" confirm-title="Confirm Clear"
>>> link-text="Clear E-Messages"
>>> confirm-message="'Are you sure you want to clear all e-messages?'"
>>> ok-label="Yes"
>>> cancel-label="No"
>>> disable-action ="currentOperator.EMessage"
>>> ok-action="clearEMessage(currentOperator)"></data-confirm:button>
>>>
>>>I want to disable the button if the eMessage is empty.
>>
>>Since I don't know what 'disable-action' is it's a bit hard to answer. Is this an angular thing? Seems odd to be passing a string.
>>
>>P.S Haven't had a change to look at your tabbing problem yet......