【发布时间】:2018-12-09 13:56:51
【问题描述】:
朋友们,我是 Angular js 的新手,我正在尝试使用 Angular Route,但是当我点击 #/home 时,它给了我一些奇怪的 URL http://127.0.0.1:3000/#!/home#%2Fhome
但默认情况下,否则条件可以正常工作http://127.0.0.1:3000/#!/home
app.config(['$routeProvider', function($routeProvider){
$routeProvider
.when('/home', {
templateUrl: 'views/home.html'
})
.when('/list', {
templateUrl: 'Views/listing.html',
controller: 'mycontroller'
}).otherwise({
redirectTo: '/home'
})
}]);
【问题讨论】:
-
对于 /home,你可以简单地给出 '/' 而不是 '/home' 并且请分享你的 html 以及 home
标签: javascript html css angularjs ngroute