i am using angular-ui-router and i have a resolve that brings me some data from the DB by a service.
now i want to inject it into my controller.
but, my controller is not defined in the state, rather just in my application.
this look like this:
.state('myState', {
url: "/create",
templateUrl: "views/create.html",
resolve: {
templates : function(templateService){
return templateService.allMetadata.query({}, function(data){
}, function(err){
console.log(err);
});
}
},
controller: 'createCtrl'
so how can i inject my templates into my createCtrl which was defined elsewhere.
trying to put a dependency injection my in createCtrl didn't work. it seems that the my only option is to decalre my controller inside the state decleration. this is obviously very bad.
any solution?