David
David

Reputation: 1144

AngularJS error injector modulerr

I'm trying to run this AngularJS example of a tutorial and the console says: Uncaught Error: [$injector:modulerr]

Where is the problem?

<div class="container" data-ng-app="demoApp">
    <div>
        <h3>Adding Module Configuration and Routing</h3>

        <div data-ng-view=""></div>
    </div>
</div>

  <script src="angular-1.2.3/angular.min.js"></script>
  <script src="angular-1.2.3/angular-route.min.js"></script>

<script>
    var demoApp = angular.module('demoApp', ['ngRoute']);

    demoApp.config(function ($routeProvider) {
        $routeProvider
            .when('/',
                {
                    controller: 'SimpleController',
                    templateUrl: urlBase + '7. Partial1.html'
                })

            .when('/partial2',
                {
                    controller: 'SimpleController',
                    templateUrl: 'Partial/view1.html'
                })
            .otherwise({ redirectTo: '/' });
    });

    demoApp.controller('SimpleController', function ($scope) {
        $scope.customers = [
            { name: 'Dave Jones', city: 'Phoenix' },
            { name: 'Jamie Riley', city: 'Atlanta' },
            { name: 'Heedy Wahlin', city: 'Chandler' },
            { name: 'Thomas Winter', city: 'Seattle' }
        ];
    }); 
</script>

Upvotes: 2

Views: 7538

Answers (1)

tymeJV
tymeJV

Reputation: 104775

You need to remove the ="" from the ng-view attribute.

Upvotes: 5

Related Questions