Optimize blog component routing

keep-around/dc735e80914fa50c9bca8f6c78c100b7ed19408f
Florian Hartwich 2017-03-03 09:05:29 +01:00
parent f11ff13256
commit 8153c2a986
8 changed files with 10 additions and 8 deletions

View File

@ -6,9 +6,10 @@ import {AboutComponent} from './about/about.component';
import {LoginComponent} from './login/index';
import {BlogComponent} from './blog/blog.component';
import {NotFoundComponent} from './not-found/not-found.component';
import {tasksRoutes, tasksRoutingComponents, tasksRoutingProviders, blogComponents} from './tasks/tasks.routing';
import {tasksRoutes, tasksRoutingComponents, tasksRoutingProviders} from './tasks/tasks.routing';
import {RxDemoComponent} from './rxdemo/rxdemo.component';
import {LoginGuard} from './login/login.guard';
import {blogRoutingComponents} from "./blog/blog.routing";
export const appRoutes: Routes = [
{path: 'dashboard', component: DashboardComponent, data: {title: 'Startseite'}},
@ -33,7 +34,7 @@ export const appRoutes: Routes = [
export const appRouting = RouterModule.forRoot(appRoutes);
export const routingComponents = [DashboardComponent, SettingsComponent, AboutComponent, LoginComponent, NotFoundComponent,
RxDemoComponent, ...blogComponents, ...tasksRoutingComponents];
RxDemoComponent, ...blogRoutingComponents, ...tasksRoutingComponents];
export const routingProviders = [LoginGuard,
...tasksRoutingProviders];

View File

@ -1,6 +1,6 @@
import {Component, Input } from '@angular/core';
import {BlogEntry} from './blog-entry';
import {BlogComponent} from "./blog.component";
import {BlogComponent} from "../blog.component";
@Component({
selector: 'blog-entry',

View File

@ -1,4 +1,4 @@
<h1>Mein Angular-Blog</h1>
<h1>Angular-Blog</h1>
<blog-entry *ngFor="let entry of entries" [entry]="entry" [blogComponent]="this"></blog-entry>
<h2>Neuen Blog-Eintrag erstellen</h2>

View File

@ -2,7 +2,7 @@ import {Component} from '@angular/core';
import {ActivatedRoute, ActivatedRouteSnapshot, Router, RouterStateSnapshot} from '@angular/router';
import {Title} from '@angular/platform-browser';
import {initialEntries} from './initialEntries';
import {BlogEntry} from './blog-entry';
import {BlogEntry} from './blog-entry/blog-entry';
@Component({
selector: 'blog',

View File

@ -0,0 +1,4 @@
import {BlogComponent} from "./blog.component";
import {BlogEntryComponent} from "./blog-entry/blog-entry.component";
export const blogRoutingComponents = [BlogComponent, BlogEntryComponent];

View File

@ -5,8 +5,6 @@ import {EditTaskGuard} from './edit-task/edit-task.guard';
import {TaskOverviewComponent} from './task-overview/task-overview.component';
import {TasksComponent} from './tasks.component';
import {LoginGuard} from '../login/login.guard';
import {BlogComponent} from "../blog/blog.component";
import {BlogEntryComponent} from "../blog/blog-entry.component";
export const tasksRoutes: Routes = [{
path: '', component: TasksComponent,
@ -35,4 +33,3 @@ export const tasksRoutes: Routes = [{
export const tasksRoutingComponents = [TasksComponent, TaskListComponent, EditTaskComponent, TaskOverviewComponent];
export const tasksRoutingProviders = [EditTaskGuard];
export const blogComponents = [BlogComponent, BlogEntryComponent];