File tree Expand file tree Collapse file tree 3 files changed +29
-31
lines changed Expand file tree Collapse file tree 3 files changed +29
-31
lines changed Original file line number Diff line number Diff line change 373373 var position = legend . position || 'bottomright' ;
374374 var leafletLegend ;
375375 controller . getMap ( ) . then ( function ( map ) {
376- if ( ! isDefined ( legend . url ) && ( ! isArray ( legend . colors ) || ! isArray ( legend . labels ) || legend . colors . length !== legend . labels . length ) ) {
377- $log . warn ( '[AngularJS - Leaflet] legend.colors and legend.labels must be set.' ) ;
378- } else if ( isDefined ( legend . url ) ) {
379- $log . info ( '[AngularJS - Leaflet] loading arcgis legend service.' ) ;
380- } else {
381- // TODO: Watch array legend.
382- leafletLegend = L . control ( { position : position } ) ;
383- leafletLegend . onAdd = leafletLegendHelpers . getOnAddArrayLegend ( legend , legendClass ) ;
384- leafletLegend . addTo ( map ) ;
385- }
376+ leafletScope . $watch ( 'legend' , function ( legend ) {
377+ if ( ! isDefined ( legend . url ) && ( ! isArray ( legend . colors ) || ! isArray ( legend . labels ) || legend . colors . length !== legend . labels . length ) ) {
378+ $log . warn ( '[AngularJS - Leaflet] legend.colors and legend.labels must be set.' ) ;
379+ } else if ( isDefined ( legend . url ) ) {
380+ $log . info ( '[AngularJS - Leaflet] loading arcgis legend service.' ) ;
381+ } else {
382+ // TODO: Watch array legend.
383+ leafletLegend = L . control ( { position : position } ) ;
384+ leafletLegend . onAdd = leafletLegendHelpers . getOnAddArrayLegend ( legend , legendClass ) ;
385+ leafletLegend . addTo ( map ) ;
386+ }
387+ } ) ;
386388 leafletScope . $watch ( 'legend.url' , function ( newURL ) {
387389 if ( ! isDefined ( newURL ) ) {
388390 return ;
You can’t perform that action at this time.
0 commit comments