Routing issue with AngularJS project using yeoman setup [duplicate]

白昼怎懂夜的黑 提交于 2019-12-17 16:41:40

问题


I have setup a new Angular project using yeoman. Angular version is 1.6.0. Project setup was successful but I have been facing an issue with routing

Task runner - Grunt

When I run the project in local my local page will load with URL

http://localhost:9000/#!/

I was expecting http://localhost:9000/#/

When clicked on About link browser is routed to

http://localhost:9000/#!/%23%2Fabout

Expectation: http://localhost:9000/#/about

When I click home link browser is routed to

http://localhost:9000/#!/%23%2F

Expectation: http://localhost:9000/#/

What might be the issue? I have no such issues in my other system where I'm using AngularJS 1.5.8.


回答1:


I got resolved with following code.You can write in your app.js file

 $locationProvider.hashPrefix('');


来源:https://stackoverflow.com/questions/41140716/routing-issue-with-angularjs-project-using-yeoman-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!