Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
$scope.$watch stopped firing
Message
De
26/11/2014 02:04:39
 
 
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01611409
Message ID:
01611434
Vues:
33
This message has been marked as a message which has helped to the initial question of the thread.
>>I don't know if this is the case or not, but I've gotten in the habit of adding an object into my scope and then adding the properties to it instead. Angular gets weird with scope inheritance and stuff can sometimes just not work.
>>
>>Ex.
>>
>>In the controller:
>>
>>$scope.data = { showFinalized : false };
>>
>>Then ng-bind to "data.showFinalized".
>>
>>(there isn't anything special about the name "data" - you could name this var anything you'd like).
>
>Thanks, Paul. Switching to use an object's property instead of direct $scope property solved this problem.

Quick and dirty way of achieving this: in the controller constructor : $scope.vm = this;
Then in the HTML use the vm prefix to reference the property.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform