Generate a new component

master
Matt Huntington 9 years ago
parent 5d870256db
commit 1483ade94b

@ -2,10 +2,12 @@ import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { SearchComponent } from './search/search.component';
@NgModule({
declarations: [
AppComponent
AppComponent,
SearchComponent
],
imports: [
BrowserModule

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SearchComponent } from './search.component';
describe('SearchComponent', () => {
let component: SearchComponent;
let fixture: ComponentFixture<SearchComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SearchComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SearchComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-search',
templateUrl: './search.component.html',
styleUrls: ['./search.component.css']
})
export class SearchComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

@ -3,6 +3,7 @@
## Lesson Objectives
1. Create a new app
1. Generate a new component
## Create a new app
@ -11,3 +12,5 @@ ng new starwars
cd starwars
ng serve --open
```
## Generate a new component

Loading…
Cancel
Save