Skip to content

Instantly share code, notes, and snippets.

@odoe
Created January 4, 2016 16:47
Show Gist options
  • Select an option

  • Save odoe/a5764f2e11c061f5d980 to your computer and use it in GitHub Desktop.

Select an option

Save odoe/a5764f2e11c061f5d980 to your computer and use it in GitHub Desktop.
import { Component, ElementRef, Output, EventEmitter } from 'angular2/core';
import MapService from './map.service';
import { MapView } from 'esri-mods';
@Component({
selector: 'esri-map',
template: '<div id="viewDiv"><ng-content></ng-content></div>',
providers: [MapService]
})
export class MapComponent {
@Output() viewCreated = new EventEmitter();
view: null;
constructor(private _service: MapService, private elRef:ElementRef) {}
ngOnInit() {
this.view = new MapView({
container: this.elRef.nativeElement.firstChild,
map: this._service.map,
zoom: 10,
center: [-120.76, 37.93]
});
this.viewCreated.next(this.view);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment