From ea3f0d652a945dbfa8324f622171bbcc1135b8b4 Mon Sep 17 00:00:00 2001 From: Nils Dittberner Date: Tue, 28 Nov 2017 11:29:22 +0100 Subject: [PATCH] 21-278 Creating basic core module --- src/app/app-routing.module.ts | 2 +- src/app/app.module.ts | 10 ++++------ src/app/core/core.module.ts | 22 ++++++++++++++++++++++ src/app/core/header/header.component.html | 28 ++++++++++++++++++++++++++++ src/app/core/header/header.component.ts | 28 ++++++++++++++++++++++++++++ src/app/core/home/home.component.css | 0 src/app/core/home/home.component.html | 1 + src/app/core/home/home.component.ts | 15 +++++++++++++++ src/app/header/header.component.html | 28 ---------------------------- src/app/header/header.component.ts | 28 ---------------------------- src/app/home/home.component.css | 0 src/app/home/home.component.html | 1 - src/app/home/home.component.ts | 15 --------------- 13 files changed, 99 insertions(+), 79 deletions(-) create mode 100644 src/app/core/core.module.ts create mode 100644 src/app/core/header/header.component.html create mode 100644 src/app/core/header/header.component.ts create mode 100644 src/app/core/home/home.component.css create mode 100644 src/app/core/home/home.component.html create mode 100644 src/app/core/home/home.component.ts delete mode 100644 src/app/header/header.component.html delete mode 100644 src/app/header/header.component.ts delete mode 100644 src/app/home/home.component.css delete mode 100644 src/app/home/home.component.html delete mode 100644 src/app/home/home.component.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 4617c72..0d8b8f7 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router' import { ShoppingListComponent } from './shopping-list/shopping-list.component'; -import { HomeComponent } from './home/home.component'; +import { HomeComponent } from './core/home/home.component'; const appRoutes: Routes = [ { path: '', component: HomeComponent }, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 90ab355..359f845 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -9,18 +9,15 @@ import { AuthGuard } from './auth/auth-guard.service'; import { AuthModule } from './auth/auth.module'; import { AuthService } from './auth/auth.service'; import { DataStorageService } from './shared/data-storage.service'; -import { HeaderComponent } from './header/header.component'; import { RecipeService } from './recipes/recipe.service'; import { SharedModule } from './shared/shared.module'; import { ShoppingListModule } from './shopping-list/shopping-list.module'; import { ShoppingListService } from './shopping-list/shopping-list.service'; -import { HomeComponent } from './home/home.component'; +import { CoreModule } from './core/core.module'; @NgModule({ declarations: [ - AppComponent, - HeaderComponent, - HomeComponent + AppComponent ], imports: [ BrowserModule, @@ -29,7 +26,8 @@ import { HomeComponent } from './home/home.component'; AppRoutingModule, SharedModule, ShoppingListModule, - AuthModule + AuthModule, + CoreModule ], providers: [ ShoppingListService, diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts new file mode 100644 index 0000000..4c5ae81 --- /dev/null +++ b/src/app/core/core.module.ts @@ -0,0 +1,22 @@ +import { NgModule } from "@angular/core"; + +import { HeaderComponent } from "./header/header.component"; +import { HomeComponent } from "./home/home.component"; +import { SharedModule } from "../shared/shared.module"; +import { AppRoutingModule } from "../app-routing.module"; + +@NgModule({ + declarations: [ + HeaderComponent, + HomeComponent + ], + imports: [ + SharedModule, + AppRoutingModule + ], + exports: [ + AppRoutingModule, + HeaderComponent + ] +}) +export class CoreModule {} \ No newline at end of file diff --git a/src/app/core/header/header.component.html b/src/app/core/header/header.component.html new file mode 100644 index 0000000..6775324 --- /dev/null +++ b/src/app/core/header/header.component.html @@ -0,0 +1,28 @@ + \ No newline at end of file diff --git a/src/app/core/header/header.component.ts b/src/app/core/header/header.component.ts new file mode 100644 index 0000000..e846498 --- /dev/null +++ b/src/app/core/header/header.component.ts @@ -0,0 +1,28 @@ +import { Component } from "@angular/core"; +import { DataStorageService } from "../../shared/data-storage.service"; +import { AuthService } from "../../auth/auth.service"; + +@Component({ + selector: 'app-header', + templateUrl: './header.component.html' +}) +export class HeaderComponent { + + constructor(private dataStorageService: DataStorageService, private authService: AuthService) {} + + onSaveData() { + this.dataStorageService.storeRecipes().subscribe( + response => { + console.log(response); + } + ); + } + + onFetchData() { + this.dataStorageService.fetchRecipes(); + } + + onLogout() { + this.authService.logout(); + } +} \ No newline at end of file diff --git a/src/app/core/home/home.component.css b/src/app/core/home/home.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/core/home/home.component.html b/src/app/core/home/home.component.html new file mode 100644 index 0000000..9522849 --- /dev/null +++ b/src/app/core/home/home.component.html @@ -0,0 +1 @@ +

Welcome to the Recipe Book

\ No newline at end of file diff --git a/src/app/core/home/home.component.ts b/src/app/core/home/home.component.ts new file mode 100644 index 0000000..33fd770 --- /dev/null +++ b/src/app/core/home/home.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-home', + templateUrl: './home.component.html', + styleUrls: ['./home.component.css'] +}) +export class HomeComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/app/header/header.component.html b/src/app/header/header.component.html deleted file mode 100644 index 6775324..0000000 --- a/src/app/header/header.component.html +++ /dev/null @@ -1,28 +0,0 @@ - \ No newline at end of file diff --git a/src/app/header/header.component.ts b/src/app/header/header.component.ts deleted file mode 100644 index b647300..0000000 --- a/src/app/header/header.component.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Component } from "@angular/core"; -import { DataStorageService } from "../shared/data-storage.service"; -import { AuthService } from "../auth/auth.service"; - -@Component({ - selector: 'app-header', - templateUrl: './header.component.html' -}) -export class HeaderComponent { - - constructor(private dataStorageService: DataStorageService, private authService: AuthService) {} - - onSaveData() { - this.dataStorageService.storeRecipes().subscribe( - response => { - console.log(response); - } - ); - } - - onFetchData() { - this.dataStorageService.fetchRecipes(); - } - - onLogout() { - this.authService.logout(); - } -} \ No newline at end of file diff --git a/src/app/home/home.component.css b/src/app/home/home.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html deleted file mode 100644 index 9522849..0000000 --- a/src/app/home/home.component.html +++ /dev/null @@ -1 +0,0 @@ -

Welcome to the Recipe Book

\ No newline at end of file diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts deleted file mode 100644 index 33fd770..0000000 --- a/src/app/home/home.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-home', - templateUrl: './home.component.html', - styleUrls: ['./home.component.css'] -}) -export class HomeComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -}