I have just noticed that by adding: this.http.get( 'http://www.mypubspace.com/pubsmobile/wherefirstletter.php?firstletter=W'). subscribe(result => this.mytownList = result); to the constructor, the list is now output
On Wednesday, February 20, 2019 at 1:17:29 PM UTC, John Biddulph wrote: > > So, I am passing a letter accross to append onto the end of my urls as > follows: > > http://www.mypubspace.com/pubsmobile/wherefirstletter.php?firstletter=L > > http://www.mypubspace.com/pubsmobile/wherefirstletter.php?firstletter=B > > > here is my function: > letterClicked($event) { > this.publist = true; > this.townlist = true; > console.log('selected Letter:', $event); > // tslint:disable-next-line:max-line-length > this.http.get(' > http://www.mypubspace.com/pubsmobile/wherefirstletter.php?firstletter=' + > $event).subscribe(result => this.mytownList = result); > // this.townService.getTowns($event).subscribe(result => this.townsList = > result); > } > $event is outputting the letter that has been clicked > > > in my HTML,I am unable to loop through my list: > > <div *ngFor="let town of mytownList; let i = index;"> > <button class="btn btn-info" (click)="townClicked(town.rstown)"> > {{town.rstown}}</button> > </div> > > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
