[Solved] how to access model or view variable in angular 4 for two way data binding

there is no scope variable in Angular 2+. In Angular 2+ there is NgModel which helps you with two way binding. https://angular.io/api/forms/NgModel To access value of text area in your component. In html <textarea class=”form-control” [(NgModel)]=comment placeholder=”Add Comment”> <input type=”button” value=”Add” (click)=”AddComment()” /> In component: comment:any=””; AddComment(){ console.log(this.comment); } Here comment var will always be … Read more