Jürgen Paul
Jürgen Paul

Reputation: 15027

my template is not being parsed

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;
        }
    };
};

The content of :

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

is instead:

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

why isn't my partials being rendered?

Upvotes: 1

Views: 171

Answers (2)

Tosh
Tosh

Reputation: 36030

Use 'templateUrl' instead of 'template' if you intend to specify url.

Upvotes: 1

Gloopy
Gloopy

Reputation: 37785

It looks like a typo try templateUrl instead of template:

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

Taken from the docs:

  • template – {string=} – html template as a string that should be used by ngView or ngInclude directives. this property takes precedence over templateUrl.
  • templateUrl – {string=} – path to an html template that should be used by ngView.

Upvotes: 4

Related Questions