2

I'm pretty new to Angular, and I'm trying to make a little app for learning.

I use the leaflet directive and want to add the NgRoute directive too but I have some errors in the console.

Here is my code :

var app = angular.module('demoapp', ['leaflet-directive'], ['ngRoute']);
app.controller("toulouseController", [ '$scope', '$http', function($scope, $http) {
  angular.extend($scope, {
    osloCenter: {},
    markers: {},
    defaults: {
      scrollWheelZoom: false
    }
  });

I don't know if I can't declare two directive at the same time...

Thanks for your help!

Mohammed Acharki
  • 234
  • 2
  • 14
Thibault
  • 137
  • 8

2 Answers2

2

Try this: var app = angular.module('demoapp', ['leaflet-directive', 'ngRoute']); That should work.

2

As per AngularJS documentation, the syntax of angular.module is

angular.module(name, [requires], [configFn]);

So you should use

angular.module('demoapp', ['leaflet-directive','ngRoute']);
                                 /\
                                 ||
                                 ||
                                 ||
                   All dependencies should be specified in single array.
Neeraj Jain
  • 7,643
  • 6
  • 34
  • 62