2017-10-02 6 views
2

私はAngularには新しく、学習のための小さなアプリを作ろうとしています。Angular NgRouteとチラシ宣言の指示

私はリーフレットディレクティブを使用していますが、NgRouteディレクティブも追加したいのですが、コンソールにいくつかのエラーがあります。あなたの助けのための

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

私は同時に2つのディレクティブを宣言することができない場合、私は知りませんが...

ありがとう:

は、ここに私のコードです!

答えて

2

お試しください:var app = angular.module('demoapp', ['leaflet-directive', 'ngRoute']); これはうまくいくはずです。

2

AngularJS documentationを1として、angular.moduleの構文は

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

あるので、あなたは

angular.module('demoapp', ['leaflet-directive','ngRoute']); 
           /\ 
           || 
           || 
           || 
        All dependencies should be specified in single array. 
+0

おかげで多くを使用する必要があり、それは働きます! – Thibault

関連する問題