简体   繁体   中英

AngularJS Routing Link does not work in Chrome

I have the following HTML to route to a different view:

<a href="#/Contacts/Create" onclick="hideCancas();">Contact</a>

The route works perfectly fine on Firefox, but gives the following error on Chrome/Safari:

GET http://localhost:55951/Contacts/Create 404 (Not Found)

It looks like WebKit is trying to actually go to the address, whereas in Moz there is no navigation, and AngularJs is handling the routing.

Any ideas what would be causing this?

For any novice AngularJs developer who stubles upon this problem like I did:

After lots of head banging, I read the console log carefully, which had a reference to jQueryMobile.js. Turns out jQueryMobile does not play nice with Angular.Js.

You can do a workaround with http://jacobmumm.com/2011/08/30/angularjs-with-jquery-mobile/ . I just ended up removing jQueryMobile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM