From 5ec3abbdf3044a0d3cccb2fe7c7ccb3ae8df5a17 Mon Sep 17 00:00:00 2001 From: taitruong Date: Mon, 11 Feb 2019 16:14:06 +0100 Subject: [PATCH] ch02 - new component my-list: ng g c my-list --- Cheatsheet02Component/src/app/app.module.ts | 4 ++- .../src/app/my-list/my-list.component.html | 3 +++ .../src/app/my-list/my-list.component.spec.ts | 25 +++++++++++++++++++ .../src/app/my-list/my-list.component.ts | 15 +++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 Cheatsheet02Component/src/app/my-list/my-list.component.html create mode 100644 Cheatsheet02Component/src/app/my-list/my-list.component.spec.ts create mode 100644 Cheatsheet02Component/src/app/my-list/my-list.component.ts diff --git a/Cheatsheet02Component/src/app/app.module.ts b/Cheatsheet02Component/src/app/app.module.ts index f657163..f07b0ff 100644 --- a/Cheatsheet02Component/src/app/app.module.ts +++ b/Cheatsheet02Component/src/app/app.module.ts @@ -2,10 +2,12 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; +import { MyListComponent } from './my-list/my-list.component'; @NgModule({ declarations: [ - AppComponent + AppComponent, + MyListComponent ], imports: [ BrowserModule diff --git a/Cheatsheet02Component/src/app/my-list/my-list.component.html b/Cheatsheet02Component/src/app/my-list/my-list.component.html new file mode 100644 index 0000000..3b80877 --- /dev/null +++ b/Cheatsheet02Component/src/app/my-list/my-list.component.html @@ -0,0 +1,3 @@ +

+ my-list works! +

diff --git a/Cheatsheet02Component/src/app/my-list/my-list.component.spec.ts b/Cheatsheet02Component/src/app/my-list/my-list.component.spec.ts new file mode 100644 index 0000000..144e36a --- /dev/null +++ b/Cheatsheet02Component/src/app/my-list/my-list.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { MyListComponent } from './my-list.component'; + +describe('MyListComponent', () => { + let component: MyListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ MyListComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(MyListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Cheatsheet02Component/src/app/my-list/my-list.component.ts b/Cheatsheet02Component/src/app/my-list/my-list.component.ts new file mode 100644 index 0000000..1c6d48c --- /dev/null +++ b/Cheatsheet02Component/src/app/my-list/my-list.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'tai-my-list', + templateUrl: './my-list.component.html', + styles: [] +}) +export class MyListComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +}