0
我一直在寻找通过多个教程和其他堆栈溢出帖子没有成功为我的app.js $ routeProvider。这里是GitHub的链接项目https://github.com/StudentJoeyJMStudios/PetPinterest.git
这里是我的app.js
var app = angular.module('se165PetPinterestWebApp', [
'ngAnimate',
'ngCookies',
'ngRoute'
]);
app.config(['$routeProvider', function($routeProvider){
$routeProvider.when('/select',
{
templateUrl: '/views/categorySelection.html',
controller: 'CatSelCtrl'
}).
otherwise(
{
redirectTo: '/'
});
}]);
当我想要导航到新的页面我知道injuect $位置,并使用$位置相依操作路径,但代码它不会导航到新页面。以这种方式浏览页面是否会重新加载js文件,例如我的服务文件?请提前帮助谢谢你。
我将它放入我的index.html只或每个HTML文件? – 2014-10-09 23:03:27
是的,ng-view进入index.html;它定义了放置路由中定义的模板/视图的位置。 – Kokaubeam 2014-10-31 03:16:49
那么只有在我的index.html文件中没有其他.html文件需要路由到? – 2014-12-05 19:27:04