Two-way Data binding using ngModel is not working in tag-inputs. Can one please help.
https://stackblitz.com/edit/angular-9muqcy?file=src%2Fapp%2Fapp.component.html
Two-way Data binding using ngModel is not working in tag-inputs. Can one please help.
https://stackblitz.com/edit/angular-9muqcy?file=src%2Fapp%2Fapp.component.html
Just change this:
hai(){
console.log(this.hi)
}
to this:
hai(){
console.log(this.Myarray)
}
Check this link: https://stackblitz.com/edit/angular-czsxvq
New Edit -
hai(){
let currItem = this.Myarray[this.Myarray.length-1]['value'];
this.Myarray.splice(this.Myarray.length-1);
this.Myarray.push(currItem);
console.log(this.Myarray)
}
You're getting this error because 'hi' is not defined, it's just declared. This post is a good explanation.
What's the difference between variable definition and declaration in JavaScript?
You need to edit your hai function.
hai(){
console.log(this.Myarray)
}
Also add this
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
@NgModule({
imports: [ BrowserModule, FormsModule, TagInputModule,BrowserAnimationsModule ],