ste ste - 1 year ago 96
AngularJS Question

Issue in Angular route

I have an AngularJS application. I recently added couple of routes but they don't work. The rest is working fine.

I included them in my index.html

<script src="privacy_policy/privacy_policy.js"></script>
<script src="contacts/contacts.js"></script>

I added them in my app.js file:

angular.module('myApp', [

The route system:

$routeProvider.when('/privacy_policy', {
templateurl: 'privacy_policy/privacy_policy.html',
data: {
needauth: false
$routeProvider.when('/contacts', {
templateurl: 'contacts/contacts.html',
data: {
needauth: false

I added a simple controller:

'use strict';

'myApp.privacy_policy', ['ngRoute']
config(['$routeProvider', function($routeProvider) {
controller('PrivacyPolicyCtrl', ["$scope", "$http", "store", "URL", function($scope, $http, store, URL) {

And some simple html:

<div ng-controller="PrivacyPolicyCtrl" class='row below-header'>

Finally I created a simple link to that view:

<li><a href='/privacy_policy'>Privacy policy</a></li>

I created the SAME things for contacts but if I click on those link ng-view is completely empty.
All the others route are working fine and I can't see any difference. I get no error on the console.

In the route system in app.js If I put a different template, for example:

$routeProvider.when('/privacy_policy', {
templateurl: 'faq/faq.html',
data: {
needauth: false

The faq page is diplayed correctly. What am I missing?

ste ste
Answer Source

Ok I finally find you what the problem is.

I only needed to change this:

templateurl: 'contacts/contacts.html',

with this:

templateUrl: 'contacts/contacts.html',
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download