我使用yeoman
生成了一个项目。路由一直很顺利。我通常有http://localhost:9000/#/movies
形式的网址,路由一直在运行。
突然,我的网址已更改为http://localhost:9000/#!/
。请注意!
因此,电影和所有其他网址都会转换为http://localhost:9000/#!/#%2Famovie
,并且路由不再有效。
bower.json
{
"name": "client",
"version": "0.0.0",
"dependencies": {
"angular": "^1.4.0",
"angular-animate": "^1.4.0",
"angular-cookies": "^1.4.0",
"angular-resource": "^1.4.0",
"angular-route": "^1.4.0",
"angular-sanitize": "^1.4.0",
"angular-touch": "^1.4.0",
"jquery": "^3.1.1",
"bootstrap-star-rating": "^4.0.1"
},
"devDependencies": {
"angular-mocks": "^1.4.0"
},
"appPath": "app",
"moduleName": "clientApp"
}
的package.json
{
"name": "client",
"private": true,
"devDependencies": {
"autoprefixer-core": "^5.2.1",
"grunt": "^0.4.5",
"grunt-angular-templates": "^0.5.7",
"grunt-concurrent": "^1.0.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-connect": "^0.9.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-cssmin": "^0.12.0",
"grunt-contrib-htmlmin": "^0.4.0",
"grunt-contrib-imagemin": "^1.0.0",
"grunt-contrib-jshint": "^0.11.0",
"grunt-contrib-uglify": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-filerev": "^2.1.2",
"grunt-google-cdn": "^0.4.3",
"grunt-jscs": "^1.8.0",
"grunt-newer": "^1.1.0",
"grunt-ng-annotate": "^0.9.2",
"grunt-postcss": "^0.5.5",
"grunt-svgmin": "^2.0.0",
"grunt-usemin": "^3.0.0",
"grunt-wiredep": "^2.0.0",
"jasmine-core": "^2.5.2",
"jit-grunt": "^0.9.1",
"jshint-stylish": "^1.0.0",
"karma": "^1.3.0",
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.2",
"phantomjs-prebuilt": "^2.1.13",
"time-grunt": "^1.0.0"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "karma start test\\karma.conf.js"
},
"dependencies": {
"bootstrap": "^4.0.0-alpha.4"
}
}
app.js
angular
.module('clientApp', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngRoute',
'ngSanitize',
'ngTouch'
])
.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainController',
contorllerAs: 'ctrl'
})
.when('/series',{
templateUrl: 'views/series.html',
controller: 'SeriesController',
controllerAs: 'ctrl'
})
...etc..
链接
<div class="row-fluid">
<div class="col-md-11 vcenter">
<h4>New Tv shows</h4>
</div>
<div class="col-md-1"><a href="#/series">show all</a></div>
<br/>
</div>
非常感谢任何帮助解决此问题。