Skip to content

Commit

Permalink
Merge pull request #1 from jwasilgeo/maintenance/upgrade-to-esri-loader
Browse files Browse the repository at this point in the history
replaced angular2-esri-loader with esri-loader; jsapi 4.6 version bump
  • Loading branch information
jccartwright committed Jan 12, 2018
2 parents e676627 + 200cb5d commit 3b4fcaf
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 49 deletions.
37 changes: 3 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
"@angular/platform-browser": "^4.2.4",
"@angular/platform-browser-dynamic": "^4.2.4",
"@angular/router": "^4.2.4",
"angular2-esri-loader": "^1.0.0",
"core-js": "^2.4.1",
"esri-loader": "^1.1.0",
"esri-loader": "^2.0.0",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
Expand Down
3 changes: 1 addition & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
} from '@angular/material';
// import { MatButton } from '@angular/material/button';
import { AppComponent } from './app.component';
import { EsriLoaderService } from 'angular2-esri-loader';
import { EsriMapComponent } from './esri-map/esri-map.component';
import { HeaderComponent } from './header/header.component';
import { AoiComponent, CoordinateDialog } from './aoi/aoi.component';
Expand Down Expand Up @@ -44,7 +43,7 @@ import { OptionsComponent } from './options/options.component';
MatInputModule
],
entryComponents: [ CoordinateDialog ],
providers: [EsriLoaderService],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
4 changes: 2 additions & 2 deletions src/app/esri-map/esri-map.component.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* import the required JSAPI css */
@import 'https://js.arcgis.com/4.3/esri/css/main.css';
@import 'https://js.arcgis.com/4.6/esri/css/main.css';

.esri-view {
height: 500px;
height: 500px;
}
16 changes: 7 additions & 9 deletions src/app/esri-map/esri-map.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Component, OnInit, ViewChild, ElementRef, EventEmitter, Output } from '@angular/core';

// also import the "angular2-esri-loader" to be able to load JSAPI modules
import { EsriLoaderService } from 'angular2-esri-loader';
// also import "esri-loader" methods to be able to load JSAPI modules
// loadScript is optional if always using the latest JSAPI 4.x version
import { loadScript, loadModules } from 'esri-loader';

@Component({
selector: 'app-esri-map',
Expand Down Expand Up @@ -30,9 +31,6 @@ export class EsriMapComponent implements OnInit {
@ViewChild('mapViewNode') private mapViewEl: ElementRef;


constructor( private esriLoader: EsriLoaderService) { }


activateDraw() {
this.drawingActive.emit(true);
if (this.extentGraphic) {
Expand Down Expand Up @@ -147,10 +145,10 @@ export class EsriMapComponent implements OnInit {
//TODO any concern w/ putting all logic w/in the init lifecycle handler?
public ngOnInit() {
// only load the ArcGIS API for JavaScript when this component is loaded
return this.esriLoader.load({
url: 'https://js.arcgis.com/4.5/'
return loadScript({

This comment has been minimized.

Copy link
@tomwayson

tomwayson Jan 12, 2018

FYI - you can replace this w/

    return loadModules([
      'esri/Map',
      'esri/views/MapView',
      'esri/Graphic',
      'esri/geometry/Extent',
      "esri/geometry/support/webMercatorUtils"
    ], {
      url: 'https://js.arcgis.com/4.6/'
    }).then(([
        Map,
        MapView,
        Graphic,
        Extent,
        webMercatorUtils
      ]) => {

This comment has been minimized.

Copy link
@tomwayson

tomwayson Jan 12, 2018

of course if you did that, you would not need to import loadScript above.

This comment has been minimized.

Copy link
@jwasilgeo

jwasilgeo Jan 12, 2018

Contributor

Thanks for the info, @tomwayson! 👍

url: 'https://js.arcgis.com/4.6/'
}).then(() => {
this.esriLoader.loadModules([
loadModules([
'esri/Map',
'esri/views/MapView',
'esri/Graphic',
Expand All @@ -177,4 +175,4 @@ export class EsriMapComponent implements OnInit {
});
}

}
}

0 comments on commit 3b4fcaf

Please sign in to comment.