Michelangelo
Michelangelo

Reputation: 5948

Routing not working AngularJS, just adding a hash

So I started out with AngularJS and I think it is amazing if you finally will master it, but for now I am really frustrated. I am trying to use routing. Everything works fine and there are no errors in the console, but Angular does not inject any content in my HTML :(. I am testing this on a localhost and the only thing angular does is adding a hash, like this: myAngularfolder/#/

Here is my code:

HTML

<!doctype html>

<html ng-app="app">

<head>

    <title>AngularJS</title>
    <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
    <script src="https://code.angularjs.org/1.3.9/angular.js"></script>
    <script src="https://code.angularjs.org/1.3.9/angular-route.js"></script>
    <script src="app.js"></script>

</head>

<body>

    <nav>
        <ul>
            <li><a href="index.html">Home</a>
            </li>
            <li><a href="about.html">Verhaals</a>
            </li>
            <li><a href="info.html">Info</a>
            </li>

        </ul>

    </nav>

    <div id="container" ng-view="">

    </div>

</body>

</html>

JS

  angular.module("app", ['ngRoute'])

  .config(function ($routeProvider) {
      $routeProvider
          .when('/', {
              templateURL: '/partials/products.html'
          })


  });

Any ideas?

Upvotes: 0

Views: 368

Answers (1)

dfsq
dfsq

Reputation: 193261

Change

templateURL: '/partials/products.html'

to

templateUrl: '/partials/products.html'

Upvotes: 2

Related Questions