Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Practica1</title>
  6. <base href="/">
  7.  
  8. <meta name="viewport" content="width=device-width, initial-scale=1">
  9. <link rel="icon" type="image/x-icon" href="favicon.ico">
  10. <link rel="stylesheet" href="styles.css">
  11. </head>
  12. <body>
  13. <app-root>Cargando.</app-root>
  14. </body>
  15. </html>
  16.  
  17. import { Component } from '@angular/core';
  18.  
  19. @Component({
  20. moduleId: module.id,
  21. selector: 'my-root',
  22. template: `
  23. <h1>{{title}}</h1>
  24. <nav>
  25. <a routerLink="/dashboard" routerLinkActive="active">Dashboard</a>
  26. <a routerLink="/heroes" routerLinkActive="active">Heroes</a>
  27. </nav>
  28. <router-outlet></router-outlet>
  29. `,
  30. styleUrls: ['./app.component.css'],
  31. })
  32. export class AppComponent {
  33. title = 'Tour of Heroes';
  34. }
  35. import { Component } from '@angular/core';
  36.  
  37. @Component({
  38. moduleId: module.id,
  39. selector: 'my-applicacion',
  40. template: `
  41. <h1>{{title}}</h1>
  42. <nav>
  43. <a routerLink="/dashboard" routerLinkActive="active">Dashboard</a>
  44. <a routerLink="/heroes" routerLinkActive="active">Heroes</a>
  45. </nav>
  46. <router-outlet></router-outlet>
  47. `,
  48. styleUrls: ['./app.component.css'],
  49. })
  50. export class AppComponent {
  51. title = 'Tour of Heroes';
  52. }
  53.  
  54.  
  55. /*
  56. Copyright 2017 Google Inc. All Rights Reserved.
  57. Use of this source code is governed by an MIT-style license that
  58. can be found in the LICENSE file at http://angular.io/license
  59. */
  60.  
  61. import { NgModule } from '@angular/core';
  62. import { RouterModule, Routes } from '@angular/router';
  63.  
  64. import { DashboardComponent } from './dashboard.component';
  65. import { HeroesComponent } from './heroes.component';
  66. import { HeroDetailComponent } from './hero-detail.component';
  67.  
  68. const routes: Routes = [
  69. { path: '', redirectTo: '/dashboard', pathMatch: 'full' },
  70. { path: 'dashboard', component: DashboardComponent },
  71. { path: 'detail/:id', component: HeroDetailComponent },
  72. { path: 'heroes', component: HeroesComponent }
  73. ];
  74.  
  75. @NgModule({
  76. imports: [ RouterModule.forRoot(routes) ],
  77. exports: [ RouterModule ]
  78. })
  79. export class AppRoutingModule {}
  80.  
  81.  
  82. /*
  83. Copyright 2017 Google Inc. All Rights Reserved.
  84. Use of this source code is governed by an MIT-style license that
  85. can be found in the LICENSE file at http://angular.io/license
  86. */
  87.  
  88. import { BrowserModule } from '@angular/platform-browser';
  89. import { NgModule } from '@angular/core';
  90. import { FormsModule } from '@angular/forms';
  91. import { HttpModule } from '@angular/http';
  92. import { RouterModule } from '@angular/router';
  93.  
  94. import { AppComponent } from './app.component';
  95. import { HeroDetailComponent } from './hero-detail.component';
  96. import { HeroesComponent } from './heroes.component'
  97. import { HeroService } from './hero.service'
  98. import {DashboardComponent} from './dashboard.component'
  99.  
  100. import {AppRoutingModule} from './app-routing.module';
  101.  
  102. @NgModule({
  103. declarations: [
  104. AppComponent,
  105. HeroDetailComponent,
  106. HeroesComponent,
  107. DashboardComponent,
  108. ],
  109. imports: [
  110. BrowserModule,
  111. FormsModule,
  112. HttpModule,
  113. AppRoutingModule,
  114. ],
  115. providers: [
  116. HeroService
  117. ],
  118. bootstrap: [AppComponent]
  119. })
  120.  
  121. export class AppModule { }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement