Guest User

Untitled

a guest
Jan 16th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. import { NgModule } from '@angular/core';
  2. import { Routes, RouterModule } from '@angular/router';
  3. import { FormsModule, ReactiveFormsModule } from '@angular/forms';
  4. import { RegisterComponent } from "app/modules/register/register.component";
  5.  
  6.  
  7. const routes: Routes = [
  8. {
  9. path: '', pathMatch: 'full',
  10. component: RegisterComponent
  11. }
  12. ];
  13.  
  14. @NgModule({
  15. imports: [
  16. RouterModule.forChild(routes),
  17. FormsModule,
  18. ReactiveFormsModule
  19. ],
  20. declarations: [RegisterComponent],
  21. exports: [RouterModule]
  22. })
  23. export class RegisterRouter { }
  24.  
  25. import { NgModule } from '@angular/core';
  26. import { CommonModule } from '@angular/common';
  27. import { RegisterRouter } from './register.router';
  28.  
  29.  
  30. @NgModule({
  31. imports: [
  32. CommonModule,
  33. RegisterRouter
  34. ],
  35. declarations: []
  36. })
  37. export class RegisterModule { }
  38.  
  39. import { Component, OnInit, ViewContainerRef } from '@angular/core';
  40. import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
  41.  
  42. @Component({
  43. selector: 'app-register',
  44. templateUrl: './register.component.html',
  45. styleUrls: ['./register.component.scss']
  46. })
  47. export class RegisterComponent implements OnInit {
  48.  
  49. //#region Declarations
  50. UserForm: FormGroup;
  51. inValid: boolean = false;
  52. //#endregion
  53.  
  54. constructor(
  55. private _fb: FormBuilder) {
  56. this.UserForm = _fb.group({
  57. "_firstname" : ['', Validators.required]
  58. });
  59. }
  60. }
  61.  
  62. <input type="text" class="form-control" [ngClass]="{ahinValid: inValid}" id="txtFirst_Name" aria-describedby="ariaFirstName" placeholder="Enter First Name"
  63. name="_firstname" [formControl]="UserForm.controls['_firstname']">
Add Comment
Please, Sign In to add comment