Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d3f6778

Browse files
Third step: Creating the Login Component
1 parent bcbee40 commit d3f6778

File tree

7 files changed

+80
-3
lines changed

7 files changed

+80
-3
lines changed

‎src/app/app-routing.module.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import { NgModule } from '@angular/core';
22
import { Routes, RouterModule } from '@angular/router';
33

4-
5-
const routes: Routes = [];
4+
const routes: Routes = [
5+
{
6+
path: '',
7+
loadChildren: () => import('./login/login.module').then(m => m.LoginModule),
8+
data: { preload: true }
9+
}
10+
];
611

712
@NgModule({
813
imports: [RouterModule.forRoot(routes)],
914
exports: [RouterModule]
1015
})
11-
export class AppRoutingModule {}
16+
export class AppRoutingModule {}

‎src/app/login/login-routing.module.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { NgModule } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
3+
import { LoginComponent } from './login.component';
4+
5+
const routes: Routes = [
6+
{
7+
path: '',
8+
component: LoginComponent
9+
}
10+
];
11+
12+
@NgModule({
13+
imports: [RouterModule.forChild(routes)],
14+
exports: [RouterModule]
15+
})
16+
export class LoginRoutingModule {}

‎src/app/login/login.component.css

Whitespace-only changes.

‎src/app/login/login.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>login works!</p>

‎src/app/login/login.component.spec.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { LoginComponent } from './login.component';
4+
5+
describe('LoginComponent', () => {
6+
let component: LoginComponent;
7+
let fixture: ComponentFixture<LoginComponent>;
8+
9+
beforeEach(async(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [ LoginComponent ]
12+
})
13+
.compileComponents();
14+
}));
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(LoginComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});

‎src/app/login/login.component.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Component, OnInit } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-login',
5+
templateUrl: './login.component.html',
6+
styleUrls: ['./login.component.css']
7+
})
8+
export class LoginComponent implements OnInit {
9+
10+
constructor() { }
11+
12+
ngOnInit() {
13+
}
14+
15+
}

‎src/app/login/login.module.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { NgModule } from '@angular/core';
2+
import { CommonModule } from '@angular/common';
3+
4+
import { LoginRoutingModule } from './login-routing.module';
5+
import { LoginComponent } from './login.component';
6+
7+
8+
@NgModule({
9+
declarations: [LoginComponent],
10+
imports: [
11+
CommonModule,
12+
LoginRoutingModule
13+
]
14+
})
15+
export class LoginModule { }

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /