Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF in JavaScript
Message
From
04/08/2014 15:15:29
 
General information
Forum:
Javascript
Category:
Other
Miscellaneous
Thread ID:
01605133
Message ID:
01605152
Views:
26
Viv already answered, but the expression to google for would be ternary operator if you decide to branch out into other languages...

>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.
>
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform