Reputation: 3779
In my code I have two directives. One is inside the controller scope and the other is not in the html
part.
<div ng-show="isStore==true">
<packgroup-directive>
</packgroup-directive>
<div class="lineBreaker" ng-if="groupList.length>0"></div>
<div ng-controller="WalletController">
<outfit-directive></outfit-directive>
<div class="imageContainer" ng-show="getPurchaseState() == false" ng-click="buyAllOutfit()">
<img class="feature1" ng-src="/app/app_resources/language/en/resources/{{buyAllOutfitBanner}}"/>
<div class="buttonBanner">{{allOutfitBannerValue}}
<img style="width: 20%" ng-src="/app/app_resources/icons/pep_sign_black.png"></div>
</div>
</div>
Here packgroup-directive
is not having the controller tag outside and the outfit-directive
is inside the WalletController
tag.
So the problem I am facing is that I am having a variable popupopen
which controls the closing of the popup. In my controller I call this function from another JS file :
$scope.checkPopup = function(){
if(popupOpen==1 && dialogID!=null){
ngDialog.close(dialogID);
ngDialog.close($scope.dialogID);
bridge.getPopupState("0");
}
}
This function is called from other JS file but the updated value is only shown for the packgroup directive
but not for the outfit-directive
, but when I remove it from the WalletController
tag it displays the correct value.
Code : https://jsfiddle.net/x1x1ug5y/
Upvotes: 1
Views: 38
Reputation: 5988
The problem is that you have two isolated scopes. One is parent (used by packgroup) and one is child (used by WalletController). So to achive desired behavior you need to share data between them. This can be done with next approach:
Hope this helps. Also you can read this article
Upvotes: 1