Guest User

Untitled

a guest
Jul 17th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import { Component, OnInit } from "@angular/core";
  2.  
  3. import { Hero, magicFormBuilder } from "./index";
  4. import { FormGroup } from "@angular/forms";
  5.  
  6. @Component({
  7. selector: 'app-root',
  8. template: `
  9. <form [formGroup]="heroForm">
  10. <div class="form-group">
  11. <label class="center-block">ID:
  12. <input class="form-control" formControlName="id">
  13. </label>
  14. <label class="center-block">Name:
  15. <input class="form-control" formControlName="name">
  16. </label>
  17. </div>
  18. </form>
  19.  
  20. {{ heroForm.valid }}
  21. `
  22. })
  23. export class AppComponent implements OnInit {
  24.  
  25. public heroForm: FormGroup;
  26.  
  27. ngOnInit() {
  28. const hero = new Hero();
  29. this.heroForm = magicFormBuilder(hero);
  30. }
  31. }
Add Comment
Please, Sign In to add comment