ui-router: Syntax error, unrecognized expression: #/...
I recently started getting these errors when I click on a ui-sref link, EVEN THOUGH it still takes me to the given state / templateUrl. Here’s a small snippet from my app.js file:
.state('prepare', {
abtract: true,
url: '/prepare',
templateUrl: 'prepare/prepare.html',
controller: 'prepareController'
})
.state('prepare.propinss', {
url: '/propinss',
templateUrl: 'prepare/question.html'
})
The abstract state (‘prepare’) doesn’t cause an error to be recorded in the log, but the ‘prepare.propinss’ state does cause it:
Uncaught Error: Syntax error, unrecognized expression: #/prepare/propinss
BTW, the actual error itself comes from jquery.js:1437 (Sizzle.error = func…).
It seems I can safely ignore this error, but I’d prefer to eliminate it, just in case it does eventually cause me a real issue.
Thanks!
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 18 (1 by maintainers)
i too had the same issue and after few hours stuggle, i found out i had something like this in the navigation bar. i just removed data-toggle=“collapse” and problem solved.
Removing uses of data-toggle with ui-sref solved the issue for me
@stwiname thnx worked beautifully. so fixed by removing data-toggle=“tab”
If you use bootstrap, remove the “nav” class:
+1 Having this issue with v0.2.13
@stwiname’s fix works, but I don’t want to remove the data-toggle=“collapse” because I need it.