Differenzansicht 04-modules
im Vergleich zu 03-event-binding

← Zurück zur Übersicht | Demo | Quelltext auf GitHub
src/app/app.module.ts CHANGED
@@ -3,20 +3,16 @@ import { BrowserModule } from '@angular/platform-browser';
3
 
4
  import { AppRoutingModule } from './app-routing.module';
5
  import { AppComponent } from './app.component';
6
- import { BookListComponent } from './book-list/book-list.component';
7
- import { BookListItemComponent } from './book-list-item/book-list-item.component';
8
- import { BookDetailsComponent } from './book-details/book-details.component';
9
 
10
  @NgModule({
11
  declarations: [
12
  AppComponent,
13
- BookListComponent,
14
- BookListItemComponent,
15
- BookDetailsComponent
16
  ],
17
  imports: [
18
  BrowserModule,
19
- AppRoutingModule
 
20
  ],
21
  providers: [],
22
  bootstrap: [AppComponent]
3
 
4
  import { AppRoutingModule } from './app-routing.module';
5
  import { AppComponent } from './app.component';
6
+ import { BooksModule } from './books/books.module';
 
 
7
 
8
  @NgModule({
9
  declarations: [
10
  AppComponent,
 
 
 
11
  ],
12
  imports: [
13
  BrowserModule,
14
+ AppRoutingModule,
15
+ BooksModule
16
  ],
17
  providers: [],
18
  bootstrap: [AppComponent]
src/app/{book-details → books/book-details}/book-details.component.ts RENAMED
@@ -1,5 +1,5 @@
1
  import { Component, Input, Output, EventEmitter } from '@angular/core';
2
- import { Book } from '../shared/book';
3
 
4
  @Component({
5
  selector: 'bm-book-details',
1
  import { Component, Input, Output, EventEmitter } from '@angular/core';
2
+ import { Book } from '../../shared/book';
3
 
4
  @Component({
5
  selector: 'bm-book-details',
src/app/{book-list → books/book-list}/book-list.component.ts RENAMED
@@ -1,6 +1,6 @@
1
  import { Component, EventEmitter, Output } from '@angular/core';
2
 
3
- import { Book } from '../shared/book';
4
 
5
  @Component({
6
  selector: 'bm-book-list',
1
  import { Component, EventEmitter, Output } from '@angular/core';
2
 
3
+ import { Book } from '../../shared/book';
4
 
5
  @Component({
6
  selector: 'bm-book-list',
src/app/{book-list-item → books/book-list-item}/book-list-item.component.ts RENAMED
@@ -1,5 +1,5 @@
1
  import { Component, Input } from '@angular/core';
2
- import { Book } from '../shared/book';
3
 
4
  @Component({
5
  selector: 'bm-book-list-item',
1
  import { Component, Input } from '@angular/core';
2
+ import { Book } from '../../shared/book';
3
 
4
  @Component({
5
  selector: 'bm-book-list-item',
src/app/books/books-routing.module.ts ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ import { NgModule } from '@angular/core';
2
+ import { RouterModule, Routes } from '@angular/router';
3
+
4
+ const routes: Routes = [];
5
+
6
+ @NgModule({
7
+ imports: [RouterModule.forChild(routes)],
8
+ exports: [RouterModule]
9
+ })
10
+ export class BooksRoutingModule { }
src/app/books/books.module.ts ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+
4
+ import { BooksRoutingModule } from './books-routing.module';
5
+ import { BookListComponent } from './book-list/book-list.component';
6
+ import { BookListItemComponent } from './book-list-item/book-list-item.component';
7
+ import { BookDetailsComponent } from './book-details/book-details.component';
8
+
9
+ @NgModule({
10
+ declarations: [
11
+ BookListComponent,
12
+ BookListItemComponent,
13
+ BookDetailsComponent
14
+ ],
15
+ imports: [
16
+ CommonModule,
17
+ BooksRoutingModule
18
+ ],
19
+ exports: [
20
+ BookListComponent,
21
+ BookDetailsComponent
22
+ ]
23
+ })
24
+ export class BooksModule { }