Выбор элемента из Firebase при нажатии кнопки

Вы можете использовать SUBSTRING (locations. raw, - 6,4), где условие

SELECT `users`.`first_name`, `users`.`last_name`, `users`.`email`,
SUBSTRING(`locations`.`raw`,-6,4) AS `guaranteed_postcode`
FROM `users` LEFT OUTER JOIN `locations`
ON `users`.`id` = `locations`.`user_id`
WHERE SUBSTRING(`locations`.`raw`,-6,4) NOT IN #this is where the fake col is being used
(
SELECT `postcode` FROM `postcodes` WHERE `region` IN
(
 'australia'
)
)
0
задан KENdi 13 July 2018 в 10:06
поделиться

1 ответ

//in the ts file
 constructor( public db: AngularFireDatabase) {
  this.items = db.list('items').valueChanges();
  db.list('/sentences').valueChanges().subscribe(sentences => {
    this.sentences = sentences;
    console.log(this.sentences);
    this.labels = this.sentences; //in this.labels we have all the elements *declaration : labels=[]
    console.log(this.labels);

  }); 
onSkip($i) {
  if (this.i > 13) { //if there are 13 elements in the database
    this.i = 0;
  }

  this.i = this.i + 1;
  console.log(this.i);
}    

 // in the html code
 {{labels[i]}}  

 <button class="centered" (click)="onSkip(i)" > SKIP  <a routerLink="skip">
0
ответ дан codgrl 17 August 2018 в 13:14
поделиться
Другие вопросы по тегам:

Похожие вопросы: