-
Notifications
You must be signed in to change notification settings - Fork 2k
Controller is not getting loaded/called #1606
Comments
@o1lab Nothing is jumping out at me.. a) Does your list-childs view load? return _childsService.query().$promise.then(function (childs) {
// log something here
return childs;
}); I don't recommend setting your service calls up this way, from your route resolves. This is just a simple way to test your promise is resolving. |
a) No it does not. How do you recommend - get rid of resolves entirely ? Below is what I want to achieve - fairly simple state and route state --> route Additional information: childsListController.$inject = ['$stateParams','$state', 'something_random'] |
When you removed the resolve from your "childs" route, did you also remove the injection from your controller? If so, and the controller still doesn't load then most likely your angular app is not bootstrapping your controller correctly. What does your childs module configuration look like? Do you have something similar to https://github.com/meanjs/mean/blob/master/modules/articles/client/articles.client.module.js? I don't think you need to abandon the resolves on your nested routes. It sounds like an issue with the I'm on Gitter meanjs right now, if you'd like to take the conversation there. EDIT: You can verify if your Childs controller is loading by putting a console.log directly in the controller's file. |
Is there a |
@mleanos : unfortunately I didn't see your message before I closed my day yesterday. I appreciate your offer for help. I've got it working now (see below). Thank you.
|
Im using meanjs for a webapp and have below issue.
When transitioning from state parents.view to parents.view.childs - I do not see the controller associated with parents.view.childs being called/loaded. But prints within getChilds() is seen for which I see server responding with childs data.
But I cannot understand why childs controllers is not getting called. There are no errors on console.
Is there something wrong with using controllerAs : 'vm' in both states or something else ?
Also what is the best way to debug state transitions in angular ?
angular route file
controller
The text was updated successfully, but these errors were encountered: