Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS ui-router : Could not resolve___ from state ___ Error

You are almost there, ui-router needs this:

<a ui-sref="settings.details">...

this says ui-sref navigate to state named 'settings.details', in case we would need to pass params, it is very similar like $state.go...

<a ui-sref="settings.details({param1:value1, param2:value2})">...

if we want to use url defined for states, we still can, but we must use href

<a href="#/settings">...to get to details
<a href="#/settings/quotes">...to get to quotes

if the child url is empty string like in our case

     var settings = {
            name: 'settings',
            url: '/settings',
            abstract: true,
            ...
        };

     var details = {
            name: 'settings.details',
            parent: settings,
            url: '',
            ...
        };
     var quotes = {
            name: 'settings.quotes',
            parent: settings,
            url: '/quotes',
            ...
        };

See documentation:

ui-sref

or new doc (cite)

ui-sref='stateName' - Navigate to state, no params. 'stateName' can be any valid absolute or relative state, following the same syntax rules as $state.go()