Angular NgRoute and leaflet declaration directive

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!

Answers:

Answer

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

Answer

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.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.