×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Nilesh Yadav
Added: Jul 18, 2017 6:11 AM
Modified: Jul 18, 2017 6:13 AM
Views: 7
Tags: no tags
  1.  
  2. in Component
  3. -------------
  4.  
  5. export class AppComponent {
  6.         username = "codedamn";
  7.  
  8.         changeUsername(ev) {
  9.            this.username = ev.target.value;
  10.         }
  11. }
  12.  
  13. in html
  14. -------
  15.  
  16. <input type="text" [value]="username" (input)="changeUsername($event)" />
  17.  
  18. OR
  19.  
  20. import FormsModule
  21. --------------------
  22.  
  23.  
  24. <input type="text" [(ngModule)]="username" />