import { Component , ElementRef } from '@angular/core' ; import { MapService } from './map.service' ; @ Component ( { selector : 'esri-search' , template : '<div></div>' , inputs : [ 'options' ] } ) export class SearchComponent { constructor ( private elRef , private _mapService ) { } search : any ; options : Object ; ngOnInit ( ) { this . search = this . _mapService . createSearch ( this . options , this . elRef . nativeElement . firstChild ) ; } ngAfterViewInit ( ) { this . search . startup ( ) ; } setMap ( map ) { this . search . set ( 'map' , map ) ; } ngOnDestroy ( ) { if ( this . search ) { this . search . destroy ( ) ; } } }