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

View File

@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<base href="/">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

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() { }
}

View File

@@ -25,8 +25,8 @@ paths.concatCssDest = paths.webroot + "css/site.min.css";
paths.lib = paths.webroot + "lib/";
paths.angular = paths.node_modules + "@angular/**/*.js"
paths.angularWebApi = paths.node_modules + "angular2-in-memory-web-api/*.js"
paths.angular = paths.node_modules + "@angular/**/*.js";
paths.angularWebApi = paths.node_modules + "angular2-in-memory-web-api/*.js";
paths.corejs = paths.node_modules + "core-js/client/shim*.js";
paths.zonejs = paths.node_modules + "zone.js/dist/zone*.js";
paths.reflectjs = paths.node_modules + "reflect-metadata/Reflect*.js";
@@ -64,7 +64,7 @@ gulp.task("copy:angular", function () {
return gulp.src(paths.angular,
{ base: paths.node_modules + "@angular/" })
.pipe(gulp.dest(paths.lib + "angular/"));
.pipe(gulp.dest(paths.lib + "@angular/"));
});
gulp.task("copy:angularWebApi", function () {

View File

@@ -13,13 +13,14 @@
// our app is within the app folder
app: 'app',
// angular bundles
'@angular/core': 'npm:angular/core/bundles/core.umd.js',
'@angular/common': 'npm:angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:angular/http/bundles/http.umd.js',
'@angular/forms': 'npm:angular/forms/bundles/forms.umd.js',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api',