Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html “我的观点”;指令不';它不能按预期的方式工作_Html_Angularjs_Ngroute_Ng View - Fatal编程技术网

Html “我的观点”;指令不';它不能按预期的方式工作

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

我调用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>
<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
方法需要是点表示法属性访问器。与
方法相同,否则
方法。哦,就是这样!非常感谢。如果这对你有用的话,把它标记为接受,这样其他有同样问题的人就知道该怎么办了@德萨法罗:是的!非常感谢。如果这对你有用的话,把它标记为接受,这样其他有同样问题的人就知道该怎么办了@德萨法罗