2012-09-13 4 views
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

오타 template 대신 templateUrl를 시도 할 것 같습니다 다음 docs에서 촬영

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

:

  • 템플릿 - {문자열 =} - 사용해야 문자열로 HTML 템플릿을 ngView 또는 ngInclude 지시. 이 속성은 templateUrl보다 우선합니다.
  • templateUrl - {string =} - ngView에서 사용해야하는 html 서식 파일의 경로입니다.
+0

이 비트 지난 몇 주 동안 나도 그래! 1.0.0rc11에서 변경되었습니다. – Steven

1

url을 지정하려는 경우 'template'대신 'templateUrl'을 사용하십시오.

관련 문제