Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IIF in JavaScript
Message
De
06/08/2014 14:06:29
 
 
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01605133
Message ID:
01605243
Vues:
36
This message has been marked as a message which has helped to the initial question of the thread.
>>Glad you got it working. I owe you an apology - seems that binding a property in an isolated scope of a directive is a special case.
>>The correct syntax is :
>>The attribute value on the markup for the directive should be the *name* of the property in the scope where it is used.
>>In the isolated scope you bind to the attribute name (converting snake to camel)
>>So:
Controller on the element where the directive is used:
>>$scope.disableClearMessage = true;
>>// Directive attribute:
>>disable-action = "disableClearMessage"
>>// Directive scope:
>>disableAction : '='
>>//Directive template:
>>ng-disabled = "{{disableAction}}"
>>
>>Hope that clears it up :-}
>
>In my case the template is
>
>
>template: '<a ng-click="click()" ng-disabled="disableAction" >{{ linkText }}</a>'
>
>Yet is seems to be working correctly - it is enabled when it should be enabled and disabled when it should be disabled.

Interesting. I tried it with both. Resulting markup:
//When disableClearMessage = true:

//With disableAction:
<a  ng-disabled="disableAction" class="ng-binding" disabled="disabled"></a>

//With {{disableAction}}
<a  ng-disabled="true" class="ng-binding" disabled="disabled"></a>

//When disableClearMessage = false:

//With disableAction:
<a  ng-disabled="disableAction" class="ng-binding"></a>

//With {{disableAction}} :
<a  ng-disabled="false" class="ng-binding"></a>
So both worked but using the curly braces seems more like the desired result (e.g. ng-disabled="true")
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform