This commit is contained in:
crusader 2018-01-28 17:51:26 +09:00
parent 0dfc2fe55b
commit ec7443f441
22 changed files with 210 additions and 6 deletions

View File

@ -22,6 +22,9 @@
"@angular/platform-browser": "^5.2.1", "@angular/platform-browser": "^5.2.1",
"@angular/platform-browser-dynamic": "^5.2.1", "@angular/platform-browser-dynamic": "^5.2.1",
"@angular/router": "^5.2.1", "@angular/router": "^5.2.1",
"@ngrx/core": "^1.2.0",
"@ngrx/effects": "^5.0.1",
"@ngrx/store": "^5.0.0",
"core-js": "^2.5.3", "core-js": "^2.5.3",
"hammerjs": "^2.0.8", "hammerjs": "^2.0.8",
"rxjs": "^5.5.6", "rxjs": "^5.5.6",

View File

@ -4,6 +4,8 @@ import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [ const routes: Routes = [
{ path: '', loadChildren: './pages/pages.module#PagesModule' }, { path: '', loadChildren: './pages/pages.module#PagesModule' },
{ path: 'auth', loadChildren: './pages/auth/auth.module#AuthModule' }, { path: 'auth', loadChildren: './pages/auth/auth.module#AuthModule' },
{ path: 'errors', loadChildren: './pages/errors/errors.module#ErrorsModule' },
{ path: '**', redirectTo: 'errors/404' }
]; ];
@NgModule({ @NgModule({

View File

@ -6,7 +6,7 @@ import {
MatSlideToggleModule, MatInputModule, MatCheckboxModule, MatSlideToggleModule, MatInputModule, MatCheckboxModule,
MatToolbarModule, MatSnackBarModule, MatSidenavModule, MatToolbarModule, MatSnackBarModule, MatSidenavModule,
MatTabsModule, MatSelectModule, MatRadioModule, MatTabsModule, MatSelectModule, MatRadioModule,
MatAutocompleteModule, MatFormFieldModule MatAutocompleteModule, MatFormFieldModule,
} from '@angular/material'; } from '@angular/material';
const MATERIAL_MODULES: any[] = [ const MATERIAL_MODULES: any[] = [

View File

@ -1,6 +1,5 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { AuthComponent } from './auth.component'; import { AuthComponent } from './auth.component';
import { AuthRoutingModule } from './auth-routing.module'; import { AuthRoutingModule } from './auth-routing.module';
import { SigninComponent } from './signin/signin.component'; import { SigninComponent } from './signin/signin.component';

View File

@ -1,3 +1 @@
<p> <button mat-button>Basic</button>
signin works!
</p>

View File

@ -0,0 +1,9 @@
.signin-form {
min-width: 150px;
max-width: 500px;
width: 100%;
}
.signin-full-width {
width: 100%;
}

View File

@ -1,4 +1,8 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Form, FormBuilder, FormGroup, FormGroupDirective, FormControl, NgForm, Validators } from '@angular/forms';
import { ErrorStateMatcher } from '@angular/material/core';
@Component({ @Component({
selector: 'of-auth-signin', selector: 'of-auth-signin',
@ -7,9 +11,19 @@ import { Component, OnInit } from '@angular/core';
}) })
export class SigninComponent implements OnInit { export class SigninComponent implements OnInit {
constructor() { } signInForm: FormGroup;
returnURL: string;
constructor(
private router: Router,
private activatedRoute: ActivatedRoute,
) { }
ngOnInit() { ngOnInit() {
this.returnURL = this.activatedRoute.snapshot.queryParams['returnURL'] || '/';
}
initForm() {
} }
} }

View File

@ -0,0 +1,3 @@
<p>
e404 works!
</p>

View File

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

View File

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

View File

@ -0,0 +1,3 @@
<p>
e500 works!
</p>

View File

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

View File

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

View File

@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ErrorsComponent } from './errors.component';
import { E404Component } from './e404/e404.component';
import { E500Component } from './e500/e500.component';
const routes: Routes = [
{
path: '',
component: ErrorsComponent,
children: [
{ path: '404', component: E404Component },
{ path: '500', component: E500Component },
]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class ErrorsRoutingModule { }

View File

@ -0,0 +1,3 @@
<div>eheader</div>
<router-outlet></router-outlet>
<div>efooter</div>

View File

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

View File

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

View File

@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ErrorsComponent } from './errors.component';
import { ErrorsRoutingModule } from './errors-routing.module';
import { E500Component } from './e500/e500.component';
import { E404Component } from './e404/e404.component';
@NgModule({
imports: [
CommonModule,
ErrorsRoutingModule
],
declarations: [ErrorsComponent, E500Component, E404Component]
})
export class ErrorsModule { }

View File

@ -164,6 +164,18 @@
dependencies: dependencies:
tslib "^1.7.1" tslib "^1.7.1"
"@ngrx/core@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@ngrx/core/-/core-1.2.0.tgz#882b46abafa2e0e6d887cb71a1b2c2fa3e6d0dc6"
"@ngrx/effects@^5.0.1":
version "5.0.1"
resolved "https://registry.yarnpkg.com/@ngrx/effects/-/effects-5.0.1.tgz#cf970a6b8e2f3d3647e795e7040e09a2e7d157ed"
"@ngrx/store@^5.0.0":
version "5.0.0"
resolved "https://registry.yarnpkg.com/@ngrx/store/-/store-5.0.0.tgz#483a955ea99a63ee083675ce0596d505e5501747"
"@ngtools/json-schema@1.1.0", "@ngtools/json-schema@^1.1.0": "@ngtools/json-schema@1.1.0", "@ngtools/json-schema@^1.1.0":
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/@ngtools/json-schema/-/json-schema-1.1.0.tgz#c3a0c544d62392acc2813a42c8a0dc6f58f86922" resolved "https://registry.yarnpkg.com/@ngtools/json-schema/-/json-schema-1.1.0.tgz#c3a0c544d62392acc2813a42c8a0dc6f58f86922"