Create components for two sub sections

master
Matt Huntington 9 years ago
parent 41ae649d04
commit 80b54bff33

@ -14,3 +14,8 @@ Sometimes you want to have sub sections within a specific route (routes within r
We're going to split `/about` into `/about/early-life` and `/about/career`. We're going to split `/about` into `/about/early-life` and `/about/career`.
Generate the two components: Generate the two components:
```
ng generate component early-life
ng generate component career
```

@ -7,14 +7,18 @@ import { LinksComponent } from './links/links.component';
import { ResumeComponent } from './resume/resume.component'; import { ResumeComponent } from './resume/resume.component';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { AppRoutingModule } from './app-routing.module' import { AppRoutingModule } from './app-routing.module';
import { EarlyLifeComponent } from './early-life/early-life.component';
import { CareerComponent } from './career/career.component'
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
AboutComponent, AboutComponent,
LinksComponent, LinksComponent,
ResumeComponent ResumeComponent,
EarlyLifeComponent,
CareerComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CareerComponent } from './career.component';
describe('CareerComponent', () => {
let component: CareerComponent;
let fixture: ComponentFixture<CareerComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CareerComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CareerComponent);
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-career',
templateUrl: './career.component.html',
styleUrls: ['./career.component.css']
})
export class CareerComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EarlyLifeComponent } from './early-life.component';
describe('EarlyLifeComponent', () => {
let component: EarlyLifeComponent;
let fixture: ComponentFixture<EarlyLifeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EarlyLifeComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EarlyLifeComponent);
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-early-life',
templateUrl: './early-life.component.html',
styleUrls: ['./early-life.component.css']
})
export class EarlyLifeComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
Loading…
Cancel
Save