Commit 1f690ccc authored by prumde's avatar prumde

Changes for Location capture component in SearchComponent

- Devloped by Chitranga T.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174324 ce508802-f39f-4f6c-b175-0d175dae99d5
parent e7d59a1a
<form *ngIf="headerState === 'relative'" action="#" method="post"id="search-form" [@searchInputTrans]="compFadeState"> <form *ngIf="headerState === 'relative'" action="#" method="post"id="search-form" [@searchInputTrans]="compFadeState">
<span class="search-page-border"> <input #myInput type="text"placeholder="Search Food, Tour, Events and More..."class="search-terms" name="search-terms" /> <span class="search-page-border">
<input #myInput type="text"placeholder="Search Food, Tour, Events and More..."class="search-terms" name="search-terms" />
<span class="search-which-border"> <span class="search-which-border">
<div class="locate-me">Locate Me</div> <div class="locate-me">Locate Me</div>
<div class="locate-handle"></div> <div class="locate-handle" (click)="getAddress();" ></div>
<img class="img-locate"title="Locate Me" /> <img class="img-locate"title="Locate Me" />
<select name="search-which" class="search-which"> <select name="search-which" class="search-which">
<option value="members">Mumbai</option> <option value="members">Mumbai</option>
......
import { Component, OnInit, Input, trigger, state, animate, transition, style, } from '@angular/core'; import { Component, OnInit,ViewChild,ElementRef, Input, trigger, state, animate, transition, style,Injectable } from '@angular/core';
import { EventEmitter } from '@angular/core';
import { EcmLocation } from './ecm-location';
import { EcmLocationService } from './ecm-location.service';
@Component({ @Component({
selector: 'ecm-search', selector: 'ecm-search',
...@@ -20,14 +23,44 @@ import { Component, OnInit, Input, trigger, state, animate, transition, style, ...@@ -20,14 +23,44 @@ import { Component, OnInit, Input, trigger, state, animate, transition, style,
state('fade600', style({ transform : ' translateY(-250px) scale(0.35)' })), state('fade600', style({ transform : ' translateY(-250px) scale(0.35)' })),
transition('* <=> *', animate('.3s')) transition('* <=> *', animate('.3s'))
]) ])
] ],
providers: [EcmLocationService]
}) })
export class ECMSearchComponent implements OnInit { export class ECMSearchComponent implements OnInit {
@Input('compFadeState') compFadeState: string = 'false'; @Input('compFadeState') compFadeState: string = 'false';
@Input('headerState') headerState: string = 'relative'; @Input('headerState') headerState: string = 'relative';
@ViewChild('myInput') form_address;
public selectedCity: string;
public pincode;
public form_add;
selectedPlace = 'Mumbai'; selectedPlace = 'Mumbai';
constructor() { } constructor(private _ngLocation: EcmLocationService) { }
ngOnInit() { ngOnInit() {
this.selectedCity = localStorage.getItem('city');
}
ngAfterViewChecked() {
if(this.form_add)
this.form_address.nativeElement.value=this.form_add;
}
getAddress() {
this._ngLocation.getCitydata();
EmitterService.get("selectedCity").subscribe( data =>{
this.form_add=this._ngLocation.getAddress();
});
} }
} }
@Injectable()
export class EmitterService {
private static _emitters: { [channel: string]: EventEmitter<any> } = {};
static get(channel: string): EventEmitter<any> {
if (!this._emitters[channel])
this._emitters[channel] = new EventEmitter();
return this._emitters[channel];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment