Menu icon Foundation
ui-sref producing error: "could not resolve '___' from state"

I've been racking my brain over these angular routes as I've never used them before.

I have a few links like so:

  <div class="grid-block underline large-4 medium-4">
    <div class="grid-content"><a ui-sref="/this">this</a></div>
    <div class="grid-content"><a ui-sref="/that">that</a></div>
  </div>

I can go to these urls by typing e.g. localhost/#!/that and the dynamic content loads. But if I click the link I get the error in chrome's console:

Error: Could not resolve '/this' from state ''
at Object.$state.transitionTo (foundation.js:14)
at Object.$state.go (foundation.js:14)
at foundation.js:15
at foundation.js:9
at completeOutstandingRequest (foundation.js:6)
at foundation.js:6

What have I missed about this simple thing?

linksangularroute

I've been racking my brain over these angular routes as I've never used them before.

I have a few links like so:

  <div class="grid-block underline large-4 medium-4">
    <div class="grid-content"><a ui-sref="/this">this</a></div>
    <div class="grid-content"><a ui-sref="/that">that</a></div>
  </div>

I can go to these urls by typing e.g. localhost/#!/that and the dynamic content loads. But if I click the link I get the error in chrome's console:

Error: Could not resolve '/this' from state ''
at Object.$state.transitionTo (foundation.js:14)
at Object.$state.go (foundation.js:14)
at foundation.js:15
at foundation.js:9
at completeOutstandingRequest (foundation.js:6)
at foundation.js:6

What have I missed about this simple thing?

Robert North over 4 years ago

My ui-srefs had "/"'s in them.

The error in this case is a result of the uri being wrong.

Rafi Benkual over 4 years ago

Have you tried without the / ?

This works for me

<li ui-sref-active="is-active"><a ui-sref="panel">Panel</a></li>
---
name: panel
url: /panel
title: Panel
---

You're calling the name, not the url so it will not need the /

Robert North over 4 years ago

I see now. Thanks Rafi!

This is my first time using states like this - I've always done this sort of thing manually with jquery / ajax. Incredible how much easier this makes it.

Pratibha Panchmukh over 4 years ago

Demo

Create Employee

But still it's not redirecting to "newEmployee" page. Is there any foundation js required for this?