create HomeComponent

This commit is contained in:
chsakell
2016-09-26 14:28:45 +03:00
parent fee7d8b8dd
commit 3ebf6f0550
9 changed files with 55 additions and 13 deletions

3
app/app.component.html Normal file
View File

@@ -0,0 +1,3 @@
<div class="container">
<router-outlet></router-outlet>
</div>

View File

@@ -1,6 +1,6 @@
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: '<h1>My First Angular App</h1>'
templateUrl: 'app/app.component.html'
})
export class AppComponent { }

View File

@@ -1,9 +1,23 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { routing } from './app.routes';
@NgModule({
imports: [BrowserModule],
declarations: [AppComponent],
imports: [
BrowserModule,
FormsModule,
HttpModule,
routing
],
declarations: [
AppComponent,
HomeComponent
],
bootstrap: [AppComponent]
})
export class AppModule { }

11
app/app.routes.ts Normal file
View File

@@ -0,0 +1,11 @@
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './home/home.component';
const appRoutes: Routes = [
{ path: 'home', component: HomeComponent },
{ path: '', component: HomeComponent }
];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);

View File

@@ -0,0 +1 @@
<h1>Home!!!</h1>

View File

@@ -0,0 +1,11 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'home',
templateUrl: 'app/home/home.component.html'
})
export class HomeComponent implements OnInit {
constructor() { }
ngOnInit() { }
}