asp.net mvc - Angular 2: how to get params from URL without using Routing? -


i'm trying url parameters component search using externsre service. read can use angular2 routes , params using routeparams don't think that's need because first page of angular application razor view.

i'll try explain better. url looks like: http://dev.local/listing/?city=melbourne

i'm loading root component in razor view like:

<house-list city = "@request.params["city"]"></house-list> 

then on root component have:

export class appcomponent implements oninit {     constructor(private _cityservice: cityservice) { }      response: any;     @input() city: any;      ngoninit() {         this.gethouses();     }      gethouses() {         this.__cityservice.gethousesbycity(this.city)             .subscribe(data => this.response = data);      } } 

so expecting 'city' in component gets string passed razor view it's undefined.

what doing wrong? there way of getting params without using routing? if not, right way of using razor?

angular doesn't provide special support this. can use how can query string values in javascript?

from have seen location planned reworked provide support query params without using router.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -