2

I am trying to learn AngularJS. I have a navigation setup as a view and I cannot get it to display. When I look in the inspector i see <!-- ngInclude: views/nav.html -->.

index.html

<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
    <meta charset="UTF-8">
    <title>The ToDo List</title>

    <script type="text/javascript" src="assets/js/lib/angular.min.js"></script>
    <script type="text/javascript" src="https://cdn.firebase.com/js/client/2.0.4/firebase.js"></script>
    <script type="text/javascript" src="https://cdn.firebase.com/libs/angularfire/0.9.0/angularfire.min.js"></script>
    <script type="text/javascript" src="assets/js/lib/angular-route.min.js"></script>
    <script type="text/javascript" src="assets/js/lib/angular-animate.min.js"></script>
    <script type="text/javascript" src="assets/js/app.js"></script>
    <script type="text/javascript" src="assets/js/controllers/activetaskscontoller.js"></script>


</head>
<body>
    <div class="navigation" ng-include="views/nav.html"></div>

Here is my app.js

var myApp = angular.module('myApp',
    ['ngRoute', 'firebase', 'appControllers']);

var appControllers = angular.module('appControllers', ['firebase']);

myApp.config(['$routeProvider',function($routeProvider) {
    $routeProvider.
        when('/active-tasks', {
            templareUrl: 'views/active-tasks.html',
            controller: 'ActiveTasksController',
        }).
        when('/completed-tasks', {
            templareUrl: 'views/completed-tasks.html',
            controller: 'CompletedTasksController',
        }).
        otherwise({
            redirectTo: '/active-tasks'
        });
}]);
4
  • 1
    Try ng-include="'views/nav.html'" (notice the additional quotes) Commented Dec 21, 2014 at 22:16
  • @Vucko You are correct! That was easy. If you make it the answer I will mark it correct. Thanks for your help! Commented Dec 21, 2014 at 22:18
  • You can accept @simpe answer, he posted the same thing. Cheers :) Commented Dec 21, 2014 at 22:23
  • Will do once it allows me! Commented Dec 21, 2014 at 22:23

1 Answer 1

2

ng-include is expecting a string and not a path.

Try changing to this:

<div class="navigation" ng-include="'views/nav.html'"></div>

You can read more about the subject here: AngularJS ng-include does not include view unless passed in $scope

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.