sb-admin-angular icon indicating copy to clipboard operation
sb-admin-angular copied to clipboard

Error: Invalid state ref ''

Open ChobitsSP opened this issue 9 years ago • 5 comments

https://github.com/start-angular/sb-admin-angular/commit/1c7f647b8c2d116543a90637dd52a03be1e79199

https://github.com/angular-ui/ui-router/issues/395

ChobitsSP avatar Sep 18 '15 01:09 ChobitsSP

When I open the dasboard, the following error appears:

Error: Invalid state ref '' B@http://localhost:8888/app/bower_components/angular-ui-router/release/angular-ui-router.min.js:7:23780 D/<.link@http://localhost:8888/app/bower_components/angular-ui-router/release/angular-ui-router.min.js:7:24122 J@http://localhost:8888/app/bower_components/angular/angular.min.js:53:345 f@http://localhost:8888/app/bower_components/angular/angular.min.js:46:399 J@http://localhost:8888/app/bower_components/angular/angular.min.js:53:286 f@http://localhost:8888/app/bower_components/angular/angular.min.js:46:399 J@http://localhost:8888/app/bower_components/angular/angular.min.js:53:286 C/<@http://localhost:8888/app/bower_components/angular/angular.min.js:59:454 r/h.success/<@http://localhost:8888/app/bower_components/angular/angular.min.js:70:1 ze/e/m.promise.then/u@http://localhost:8888/app/bower_components/angular/angular.min.js:97:271 ze/g/<.then/<@http://localhost:8888/app/bower_components/angular/angular.min.js:98:417 Yd/this.$get</h.prototype.$eval@http://localhost:8888/app/bower_components/angular/angular.min.js:108:478 Yd/this.$get</h.prototype.$digest@http://localhost:8888/app/bower_components/angular/angular.min.js:106:54 Yd/this.$get</h.prototype.$apply@http://localhost:8888/app/bower_components/angular/angular.min.js:109:285 e/h<@http://localhost:8888/app/bower_components/angular/angular.min.js:119:361 e@http://localhost:8888/app/bower_components/angular/angular.min.js:37:214 se/h.defer/c<@http://localhost:8888/app/bower_components/angular/angular.min.js:40:430

In angular.min.js line 89

AitorVicomtech avatar Sep 23 '15 10:09 AitorVicomtech

+1

juancarloscancela avatar Oct 16 '15 04:10 juancarloscancela

BTW, the issue is in stats.html, where link is set with an unexistent state (line 14):

´´´< a ui-sref="{{goto}}" >´´´

just removing it as (or creating a proper state in app.js) will fix the issue.

juancarloscancela avatar Oct 16 '15 04:10 juancarloscancela

Addressing the 'invalid state ref:' error,

If anyone has problems with this, verify in your 'home.html' file that each of the elements have the goto="state.go" attribute on it. Obviously changing 'state.go' to the state you are setting to the link. Had some trouble with that one. >< hope that saves some headaches.

In my situation there were 4 tags that did not have any state assigned and the app was expecting them there.

    <stats goto="dashboard.home" number="6" comments="Comments!" colour="primary" type="comments"></stats>
    <stats goto="dashboard.customers" number={{customers.length}} comments="Customers!" colour="primary" type="user"></stats>
    <stats goto="dashboard.home" number="18" comments="New orders!" colour="yellow" type="shopping-cart"></stats>
    <stats goto="dashboard.home" number="24" comments="Support tickets!" colour="red" type="support"></stats>

I set 'dashboard.home' to the three that I have not implemented yet so that I would no longer receive the error.

lordliquid avatar Dec 22 '15 20:12 lordliquid

I was also having the same issue. Just add false to goto expression. <a ui-sref="{{goto || false}}">

dhkundan avatar Mar 18 '17 10:03 dhkundan