I have declared a state using $stateProvider
. The state looks like this:
.state('tabs.chat1', {
url : "/chat/:id",
views : {
'chat1-tab' : {
templateUrl : "templates/chat1.html",
controller : "chatController1"
}
}
In HTML I have a link with href="/chat/:{{user._id}}
. In the browser it works fine, but when I run it on an Android device tells me that the link doesn't exist. Any ideas?
Don't directly define href
like this while you have ui-sref
directive provided by ui-router
to create a href
dynamically. Mention state name in it and then provide requires params
in its JSON
, Though other way of fixing it would be href="/chat/{{user._id}}
but I don't encourage you to do this.
ui-serf="tabs.chat1(id: user._id)"
Your Href should look like this
href="#/chat/{{user._id}}"
no need for the : since the : means that it is a variable that will be fed from a link. we use a # because its loading a template not an entire new page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With