Html “我的观点”;指令不';它不能按预期的方式工作
我调用ng view,但程序从不呈现我的home.html或cart.html页面。如何让ng view开始工作 我尝试过使用多种类型的引用。我以不同的方式调用了ng view,但似乎没有任何效果Html “我的观点”;指令不';它不能按预期的方式工作,html,angularjs,ngroute,ng-view,Html,Angularjs,Ngroute,Ng View,我调用ng view,但程序从不呈现我的home.html或cart.html页面。如何让ng view开始工作 我尝试过使用多种类型的引用。我以不同的方式调用了ng view,但似乎没有任何效果 <!--My home.html:--> <h2> HOME </h2> <h1>{{message}}</h1> <!--My cart.html:--> <h2> CART </h2> <h
<!--My home.html:-->
<h2> HOME </h2>
<h1>{{message}}</h1>
<!--My cart.html:-->
<h2> CART </h2>
<h1>{{message2}}</h1>
测试Web应用程序
购物车应用程序
您有语法错误。当
myApp.config(['$routeProvider', function($routeProvider){
$routeProvider
.when('/home', {
templateUrl: 'views/home.html',
controller: 'homeController'
})
.when('/cart', {
templateUrl: 'views/cart.html',
controller: 'cartController'
})
.otherwise({
redirect: '/home'
});
}]);
您有语法错误。当
myApp.config(['$routeProvider', function($routeProvider){
$routeProvider
.when('/home', {
templateUrl: 'views/home.html',
controller: 'homeController'
})
.when('/cart', {
templateUrl: 'views/cart.html',
controller: 'cartController'
})
.otherwise({
redirect: '/home'
});
}]);
.config
块有语法错误。第二个when
方法需要是点表示法属性访问器。与方法相同,否则
方法。.config
块有语法错误。第二个when
方法需要是点表示法属性访问器。与方法相同,否则
方法。哦,就是这样!非常感谢。如果这对你有用的话,把它标记为接受,这样其他有同样问题的人就知道该怎么办了@德萨法罗:是的!非常感谢。如果这对你有用的话,把它标记为接受,这样其他有同样问题的人就知道该怎么办了@德萨法罗