angularjs - Pass data to ngDialog in Angular -


how can pass data ngdialog in angular? examples using scope this. don't use scope in controller. should do? here code inside controller:

var vm = this; authservice.login(user.name,user.password).then(function() {       $state.go('dashboard');     },function(error) {       vm.user.password = '';       ngdialog.open({         template: '<h2>error</h2><p>{{error}}</p>',         plain: true       });     }) 

any idea? thanks.

you using resolve same way routers. whatever properties define in resolve can injected controller

ngdialog.open({     template: '<h2>error</h2><p>{{error}}</p>',     plain: true,     resolve:{        error: function(){             return error;         }     },     controller: function($scope,error){         $scope.error = error;     }   }); 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -