SHARE
TWEET

Untitled

a guest Apr 2nd, 2019 36 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { NgModule } from '@angular/core';
  2. import { Routes, RouterModule } from '@angular/router';
  3. import { LoginComponent } from './login/login.component';
  4. import { SignupComponent } from './signup/signup.component';
  5. import { DocumentComponent } from './document/document.component';
  6.  
  7.  
  8. const routes: Routes = [
  9.   { path: 'login', component: LoginComponent },
  10.   { path: 'signup', component: SignupComponent},
  11.   { path: 'document', component: DocumentComponent }
  12. ];
  13.  
  14. @NgModule({
  15.   imports: [RouterModule.forRoot(routes)],
  16.   exports: [RouterModule]
  17. })
  18. export class AppRoutingModule { }
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. <!-- <p>
  29.   signup works!
  30. </p> -->
  31.  
  32. <!-- <form>
  33.   {{name}}
  34. <input type="somename" name="name" [(ngModel)]="name" />
  35.  
  36. <input type="text" name="username" [(ngModel)]="username" /> <br>
  37.                                                  
  38. <input type="password" name="password" [(ngModel)]="password"/> <br>
  39.  
  40. <input type="submit"  value="login" (click)="loginUser()" />
  41.  
  42. </form> -->
  43.  
  44.  
  45. <form #signupForm="ngForm" (ngSubmit)="saveUser(signupForm.value)">
  46.   <div class="panel panel-horizontal">
  47.     <div class="panel-heading">
  48.       <h3>Sign up form</h3>
  49.     </div>
  50.     <div class="panel-body">
  51.       <div class="form-group">
  52.         <label class="">username:</label>
  53.         <input type="text" class="from-control" value="tom" id="fn"
  54.                           name="username"  #username="ngModel" required ngModel/>
  55.       </div>
  56.       touched: <p>{{username.touched}}</p>
  57.       pristine: <p>{{username.pristine}}</p>
  58.       Valid: <p>{{username.valid}}</p>
  59.       <div class="form-group">
  60.         <label class="">email:</label>
  61.         <input type="text" class="from-control" name="email"  #email="ngModel" required ngModel/>
  62.       </div>
  63.       Valid: <p>{{email.valid}}</p>
  64.       touched: <p>{{email.touched}}</p>
  65.       pristine: <p>{{email.pristine}}</p>
  66.     </div>
  67.   <div class="panel-footer">
  68.     <button type="submit" id="button" [disabled]="signupForm.invalid">Save</button>
  69.   </div>  
  70. </div>
  71. </form>
  72.  
  73. {{signupForm.value | json}}
  74. Valid: {{signupForm.valid}}
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90. <!-- <p class=red>
  91.   Login
  92. </p>
  93.  -->
  94.  
  95. <form [formGroup]="singInForm" >
  96.   <div class="panel panel-horizontal">
  97.     <div class="panel-heading">
  98.       <h3>Sign up form</h3>
  99.     </div>
  100.     <div class="panel-body">
  101.       <div class="form-group">
  102.         <label class="">username:</label>
  103.       <input required type="text" formControlName="username" class="from-control"/>
  104.       </div>
  105.      
  106.       <div class="form-group">
  107.         <label class="">password:</label>
  108.         <input type="text" formControlName="password" class="from-control"/>
  109.       </div>
  110.      
  111.     </div>
  112.   <div class="panel-footer">
  113.     <button type="submit" (click)="login()" id="btn" >Save</button>
  114.   </div>  
  115. </div>
  116. </form>
  117.  
  118. {{singInForm.value | json}}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top