1
angular.module('dodgie', []).config(function($routeProvider){
    $routeProvider.when('/home', {template:'/partials/home.html', controller:dodgieCtrl   }).
      otherwise({redirectTo:'/home'});
});

function dodgieCtrl($scope, $location){
    $scope.doSearch = function(){
        if ( !$scope.newTodo.length ) {
          return;
        }
    };
};

の内容:

<div id="content" ng-view></div>

代わりに:

 <span class="ng-scope">/partials/home.html</span>

パーシャルがレンダリングされないのはなぜですか?

4

2 に答える 2

4

templateUrlの代わりにタイプミスのように見えますtemplate:

angular.module('dodgie', []).config(function($routeProvider){
    $routeProvider.when('/home', {templateUrl:'/partials/home.html', controller:dodgieCtrl   }).
      otherwise({redirectTo:'/home'});
});

ドキュメントから取得:

  • template – {string=} – ngView または ngInclude ディレクティブで使用する必要がある文字列としての html テンプレート。このプロパティは templateUrl よりも優先されます。
  • templateUrl – {string=} – ngView で使用する必要がある html テンプレートへのパス。
于 2012-09-13T04:13:55.770 に答える
1

URL を指定する場合は、'template' の代わりに 'templateUrl' を使用してください。

于 2012-09-13T04:16:17.000 に答える