Use ngFor to loop through the data

On Sun, Jan 27, 2019, 11:15 AM John Biddulph <john.mbiddu...@gmail.com
wrote:

> my search function seems to work:
>
> search() {
> this.weatherService
> .searchWeatherData(this.query)
> .subscribe(
> weather => this.weather = weather,
> error => this.errorMessage = <any>error,
> () => this.query = ''
> );
> }
>
> so in my app when I search a town: *Brighton*
> I am getting the following json data to console but how can I loop through
> this?
>
> [{"PUBID":"1149188","rsTown":"Brighton","rsPubName":"The
> Mashtun","rsPostCode":"BN11UE","rsAddress":"1 Church Street","rsWebsite":"
> www.google.com","rsTel":"01273684951","rsLat":"50.82347450","rsLong":"-0.13847680","img1":"pub1149188.jpg","rsAboutPub":null,"offer1":"1149188"},{"PUBID":"1149243","rsTown":"Brighton","rsPubName":"The
> Marlborough Hotel","rsPostCode":"BN21RD","rsAddress":"4 Princes
> Street","rsWebsite":"","rsTel":"01273
> 570028","rsLat":"50.8223086","rsLong":"-0.1359947","img1":"pub1149243.jpg","rsAboutPub":null,"offer1":"1149243"},{"PUBID":"1149305","rsTown":"Brighton","rsPubName":"The
> Market Inn","rsPostCode":"BN11HH","rsAddress":"1 Market
> Street","rsWebsite":"","rsTel":"01273329483","rsLat":"50.8214604","rsLong":"-0.1397625","img1":"pub1149305.jpg","rsAboutPub":null,"offer1":"1149305"}]
>
> in my app where I am trying to output the data using {{ weather }}
> I just get:
>
> [object Object],[object Object],[object Object],[object Object],[object
> Object],[object Object],[object Object],[object Object],[object
> Object],[object Object]
>
> here is where my repro is:
> https://github.com/jbiddulph/ang-weather
>
> --
> You received this message because you are subscribed to the Google Groups
> "Angular and AngularJS discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to angular+unsubscr...@googlegroups.com.
> To post to this group, send email to angular@googlegroups.com.
> Visit this group at https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to