[英]AngularJS routing dont work on child folders
Everything works except for the folder portfolio/acura when I go to the link it sends me to the portfolio page. 当我转到链接时,除文件夹Portfolio / Acura之外的所有内容均正常运行,它会将我发送到Portfolio页面。 but if i make i take out the "portfolio" and just makes it /acura it works just fine. 但是,如果我让我拿出“作品集”,并使其/ ac歌它就好了。
http://www.jaysg.com/#/portfolio/acura http://www.jaysg.com/#/portfolio/acura
// script.js // script.js
// create the module and name it scotchApp
// also include ngRoute for all our routing needs
var site = angular.module('site', ['ngRoute', 'ngAnimate']);
// configure our routes
site.config(function($routeProvider) {
$routeProvider
// route for the home page
.when('/', {
templateUrl : 'templates/home.html',
controller : 'mainController'
})
.when('/home', {
templateUrl : 'templates/home.html',
controller : 'mainController'
})
// route for the about page
.when('/about', {
templateUrl : 'templates/about.html',
controller : 'aboutController'
})
// route for the about page
.when('/portfolio', {
templateUrl : 'templates/portfolio.html',
controller : 'portfolioController'
})
// route for the subfolder this is what dont work
.when('portfolio/acura', {
templateUrl : 'templates/portfolio/acuransx/acura.html',
controller : 'acuransxController'
})
// route for the contact page
.when('/contact', {
templateUrl : 'templates/contact.html',
controller : 'contactController'
})
.otherwise({redirectTo:'/home'});
;
});
您忘记了/
.when('/portfolio/acura', { ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.