本文介绍了使用yeoman设置的AngularJS项目的路由问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用yeoman建立了一个新的Angular项目。 Angular版本是1.6.0。项目设置成功,但是我遇到了路由问题

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

任务运行器-Grunt

Task runner - Grunt

我运行时在本地我的本地页面中的项目将使用URL

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

我期望

当单击关于链接时,浏览器将路由到

When clicked on About link browser is routed to

期望:

当我单击家庭链接时,浏览器被路由到

When I click home link browser is routed to

期望:

可能是什么问题?我在使用AngularJS 1.5.8的其他系统中没有此类问题。

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

推荐答案

我用以下代码解决了您可以在您的app.js文件中编写

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

 $locationProvider.hashPrefix('');

这篇关于使用yeoman设置的AngularJS项目的路由问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 09:38
查看更多