angularjs - ng-if condition with model which is updated using ajax -


i have model in controller updated via asynchronous call through $http. , using flag check whether model defined or not.

 function mycontroller(modelservice){        var vm = this;        vm.mymodel = modelservice.data; // modelservice.data updated asynchronously later        vm.showdetails = typeof vm.mymodel !== 'undefined';   //flag check whether model defined or not  } 

html,

 <div ng-if='mycontroller.showdetails'>            ...  </div> 

currently div not shown after mymodel populated proper data later. please let me know i'm going wrong?

$http return promise can use like

modelservice.data()   .then(function(response){       vm.showdetails = true;    }) 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -