-1

I'm using several libraries with this project. The one that is complaining is jQuery. I'm not sure that jQuery is actually the culprit here. I've tried several different methods to get the desired result and I've ended up with a solution that results in the fewest errors and still functions correctly. OK, so I'm using jQuery, Materialize, Angular, Angular UI-Router and Angular Materialize. I have several routes defined and also nested views. So, on to the code:

<ul tabs>
  <li class="tab"><a href="#/one" ui-sref="one" ui-sref-active="active">One</a></li>
  <li class="tab"><a href="#/two" ui-sref="two" ui-sref-active="active">Two</a></li>
  <li class="tab"><a href="#/three" ui-sref="three" ui-sref-active="active">Three</a></li>
</ul>

So, this method, by combining href="#/one" with ui-sref="one" on the anchor element functions correctly, but still produces an error on the initial app load. Uncaught Error: Syntax error, unrecognized expression: #/one.

Just about all search results for this error have something to do with the format of strings and quotes. This leads me to believe that it has something to do with one of the libraries. Most likely Materialize or UI-Router. Maybe both together.

Here is a Fiddle that reproduces the problem – https://jsfiddle.net/whatisthebigpicture/9uudedvx/ – the scripts are loaded in HTML because the external scripts panel wasn't working correctly. It was a challenge to reproduce the same problem on JSFiddle, but I'm confident that if it can be solved in the Fiddle then I can apply it to my app.

Does anyone have experience using these libraries together? Is there something I can do to get rid of the error or is it up to the library devs?

25
  • I haven't used that recently, but it sure as hell seems weird for it to require you including jquery and materialize, AND an angular materialize component. The documentation doesn't even suggest doing that. github.com/krescruz/angular-materialize Commented Oct 6, 2016 at 18:01
  • Please stop adding tags to your title, they don't belong. Commented Oct 6, 2016 at 18:02
  • My original title wasn't allowed and then I thought about it and adding the library names to the title is very relevant. Commented Oct 6, 2016 at 18:04
  • It isn't relevant, as you've already added them with tags. The expression that wasn't recognized however IS relevant, and isn't included... Commented Oct 6, 2016 at 18:05
  • jQuery is required by Matarialize. Angular Materialize provides directives for Materialize and Angular to work together. Commented Oct 6, 2016 at 18:06

1 Answer 1

1

Use data-href="#/one" instead of plain old href="#/one". Working Fiddle – https://jsfiddle.net/whatisthebigpicture/rj08fosn/

https://github.com/Dogfalo/materialize/issues/2848

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.