0

I am working on porting a project over to Ui-router from ng-route. Previously my routes looked like this

{
  customData: {
    data: []
  },
  url: '/',
  templateUrl: '/',
  resolve: {
    cmsData: {
      cmsContent: cmsContent; // a function defined elswhere that reaches out   to a cms system
    }
  },
}

This allowed me to access the customData attribute on $route.current.$$route.customData, however in ui-router the behavior is not the same, as is expected. I am looking for a way to pass that custom data, unique to that route, to its resolve function.

Any ideas would be really great. I have looked at solutions like $stateParams and $state.data, but since the routes are not resolved, I don't have the current state loading (at least how I understand it)

Kim Kern
  • 54,283
  • 17
  • 197
  • 195
kfroemming
  • 301
  • 1
  • 9
  • How did you try $stateParam? – Sudarshan_SMD Jun 07 '17 at 07:34
  • Currently I am passing it in to the resolver being called in state as $stateParam.property; I am only getting the params from the previous state though and not the state that is being transitioned to – kfroemming Jun 26 '17 at 22:23
  • Go through this question: https://stackoverflow.com/questions/25647454/how-to-pass-parameters-using-ui-sref-in-ui-router-to-controller Should give you an idea. – Sudarshan_SMD Jun 27 '17 at 06:14

0 Answers0