when i remove ng-controller from view ,resolve property works perfectly fine but when i put ng-controller in template,it throws unknown provider.can any body help me out why this is happening??
app.config(['$routeProvider',function($routeProvider) {
$routeProvider.
when('/', {
templateUrl: 'page/login.html',
controller: 'loginController',
resolve: {
message: function(demoService){
return demoService.getResolveContent();
},
greeting: function(demoFactory){
return demoFactory.getGreeting();
}
}
}).
when('/profile', {
templateUrl: 'page/profile.html',
controller: 'profileController'
})
.otherwise({
redirectTo: '/'
});
}]);
function loginController($scope,$location,message,greeting){
$scope.tempfactory = greeting; }
<div style="color: white;width: 100%;height: 100%;background-color: lightgray" ng-controller="loginController">
<p>{{tempfactory}}</p>
<input type="text" ng-model="inputBoxValue">
<button style="width: 100px;height: 100px" ng-click="profilePage()"></button>
</div>
If i replace above html with this:
<div style="color: white;width: 100%;height: 100%;background-color: lightgray" >
<p>{{tempfactory}}</p>
<input type="text" ng-model="inputBoxValue">
<button style="width: 100px;height: 100px" ng-click="profilePage()"></button>
</div>
It worked perfectly fine.can any body tell me the reason of this.