tombatossals / angular-leaflet-directive

AngularJS directive to embed an interact with maps managed by Leaflet library
http://tombatossals.github.io/angular-leaflet-directive
MIT License
1.5k stars 635 forks source link

How to use Angular modules with differents paramters in same single page application #1089

Open marie15 opened 8 years ago

marie15 commented 8 years ago

Hello everyone, I'm using AngularJS in my single page application, I have to use diiferents angular modules. I declared one module like that: var app1 = angular.module('Myapp1',[]); app1.controller('MainCtrl', function($scope) { ...} And I want to use the second one with this paramter which is leaflet directive: var app2 = angular.module('Myapp2', ['leaflet-directive']); app2.controller('BasicCenterController', [ '$scope', function($scope) { ....} But when I approach like that the map not appear, that's mean the seconf module didn't work. Did you have any idea how to fix it? Thankx for advance

drewmo commented 8 years ago

On your HTML are you calling ng-app="app2" and ng-controller="BasicCenterController" ?

marie15 commented 8 years ago

Hi, yes. I found a solution right now, I combined the two modules by adding this line: angular.module("CombineModule", ["Myapp1", "Myapp2"]). But thank you so much for your time :)