import { Component , ElementRef , Output , EventEmitter } from '@angular/core' ; import { MapService } from './map.service' ; @ Component ( { selector : 'basemap-select' , template : `<select [(ngModel)]="selectedBasemap" (change)="onSelectChange($event)" class="form-control">
  <template ngFor let-basemap [ngForOf]="basemaps">
    <option value="{{basemap.name}}">{{basemap.title}}</option>
  </template>
  </select>` , providers : [ MapService ] } ) export class BasemapSelect { constructor ( private elRef , private _mapService ) { } selectedBasemap = '' ; @ Output ( ) basemapSelected = new EventEmitter ( ) ; basemaps : Object [ ] ; ngOnInit ( ) { this . basemaps = this . _mapService . getBasemaps ( ) ; } onSelectChange ( e ) { this . basemapSelected . next ( e . target . value ) ; } }