$ routeProvider does not work - angularJs

1

I'm trying to do something simple in Plunker that is loading the contents of home.html into index.html , however, .

Before it was not even working this line of code (when putting the ngRoute dapency but after adding the necessary lib worked):

var app = angular.module('plunker', ['ngRoute']);  

Now these lines are giving trouble:

app.config(['$routeProvider', function($routeProvider){
  $routeProvider.
    when('/home', {
      templareUrl: 'home.html'
    })
}]);

The goal is simple: to call the contents of home.html in index.html

Follow the link: link

    
asked by anonymous 16.09.2017 / 22:26

1 answer

1

You are using the 1.5.11 version of the angle, but you are using the 1.6.6 version of angular-route. Try to work with the same versions to avoid problems. Also, use:

<a href="#home">Go to home</a>

instead of:

<a href="\home">Go to home</a>

... because this second will attempt to load the file home.html into link rather than search within your project (otherwise it might even work on a real project, since the file might exist on your site).

In addition, in the file app.js you wrote set r eUrl instead of set t eUrl (a silly mistake, but boring to realize).

Follow plunker updated and working.

    
18.09.2017 / 19:40