angular - Pushing value of Var into an Array jquery -


i have array can contain number of values (car) depending on user has entered. want add variable array.

<div class="demo">     <span id="cartabs1"></span> </div> <ion-input type="text" placeholder="add new tag" value=""></ion-input>  <button  (click)="addtag">add</button> 

file.ts

cars = ["friends","oil","ford","peugeot","ferrari"];   ngafterviewinit() {     jquery('#cartabs1').tabselect({        tabelements: cars,        selectedtabs: [ ]   });   }   addtag() {         cars.push(jquery("#cartabs1").val());          console.log(cars);   }); 

you're missing this keyword:

 addtag() {         this.cars.push(jquery("#cartabs1").val());         console.log(this.cars);   }); 

please notice you're trying push value of span , not value entered in ion-input... intentionally?


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -