Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. /route
  2. import { NgModule } from '@angular/core';
  3. import { Routes, RouterModule } from '@angular/router';
  4. import { LoginComponent } from './login/login.component';
  5. import { SignupComponent } from './signup/signup.component';
  6.  
  7.  
  8. const routes: Routes = [
  9. {
  10. path: 'login',
  11. component: LoginComponent,
  12. },
  13. {
  14. path: 'signup',
  15. component: SignupComponent,
  16. },
  17. {
  18. path: '',
  19. redirectTo: '/home',
  20. pathMatch: 'full'
  21. }
  22. ];
  23.  
  24.  
  25. @NgModule({
  26. imports: [RouterModule.forRoot(routes)],
  27. exports: [RouterModule]
  28. })
  29. export class AppRoutingModule { }
  30. /app.module
  31. import { BrowserModule } from '@angular/platform-browser';
  32. import { NgModule } from '@angular/core';
  33.  
  34. import { AppRoutingModule } from './app-routing.module';
  35. import { AppComponent } from './app.component';
  36. import { LoginComponent } from './login/login.component';
  37. import { SignupComponent } from './signup/signup.component';
  38. import { HomeComponent } from './home/home.component';
  39. import { Login2Component } from './login2/login2.component';
  40. import { TestComponent } from './test/test.component';
  41.  
  42. @NgModule({
  43. declarations: [
  44. AppComponent,
  45. LoginComponent,
  46. SignupComponent,
  47. HomeComponent,
  48. Login2Component,
  49. TestComponent
  50. ],
  51. imports: [
  52. BrowserModule,
  53. AppRoutingModule
  54. ],
  55. providers: [],
  56. bootstrap: [AppComponent]
  57. })
  58. export class AppModule { }
  59. /app.html
  60. <html>
  61. <app-login></app-login>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement