Hi!
I am trying to resolve a service using web api dynamic in resolve before loading the controller but somehow the resolve data does not inject to the controller. Do you have any clue?
Best,
Visal
4 Answer(s)
-
0
Hi!
As I found out, to pass the resolved data to a controller, i should avoid using ng-controller in view. Instead, i should define the controller in state provider. I want to know is it a good practice? and is there any other works around since your project is using ng-controller rather defining the controller in the provider?
Best,
Visal
-
0
Hi,
Your solution seems fine. angular has many ways of doing same thing but actually I don't know any other way of it.
-
0
Hi! Honestly, I wanna validate a function on get request in SPA and I am doing on resolve. Do you know if it is the best solution to do it? Example, when deleting an organization unit, the user enters the delete url with Id param. For this case, I need to validate on server side to see if the organization unit is allowed to delete or the organization still exists (not yet deleted). If not allowed or not exist, i will reroute the user to another page. I do not want to validate in controller load because i do not want the controller view content to load. That's why I am doing in resolve. I am curious if you have another solution for this.
-
0
Hi,
This is a topic related to angularjs. You can find more resource on the web or can ask on stackoverflow. As I know, you may do it in some statechange (or state activation) event in the angular. In this event, you can make an ajax request to decide it. Some such events can accept promises. As I say, you can find something on the web, I don't know exactly it.