Bob Bob - 5 months ago 15
AngularJS Question

Angular-ui-router: how to pass parameters to $state.get?

I'm trying to get a state

todo-detail({id: id})
. I'm using
$state.get()
, but don't know, how to pass
{id: id}
arguments to it.

Answer

State need be retrived by name. If you want to know params 'id' of state. Do this:

$state.get('todo-detail').params
// return {id:id}.

In other way you can get all states with

var arrayStates = $state.get();

then find states expected in this array