V0.1f Layout Modularisierung mittels Components + Implementierung Basisfunktion Navbar
This commit is contained in:
parent
10d2fcf3b3
commit
ff7c00e08c
@ -1,4 +1,5 @@
|
||||
<h1>Einkaufszettel</h1>
|
||||
<app-header></app-header>
|
||||
<h1>Einkaufszettel1</h1>
|
||||
<app-blog-entry *ngFor="let entry of entries" [entry]="entry"></app-blog-entry>
|
||||
<h2>Neuen Einkaufszettel Eintrag anlegen:</h2>
|
||||
<div>
|
||||
@ -86,4 +87,4 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<app-footer></app-footer>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {Component} from '@angular/core';
|
||||
import {initialEntries} from './initialEntries';
|
||||
import {BlogEntry} from './blog-entry';
|
||||
import {initialEntries} from './components/blog-entry/initialEntries';
|
||||
import {BlogEntry} from './components/blog-entry/blog-entry';
|
||||
import {FormBuilder, Validators} from '@angular/forms';
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@ -32,7 +32,7 @@ export class AppComponent {
|
||||
}
|
||||
|
||||
createBlogEntry(title: string, image: string, kategorie: string, menge: string, kommentar: string, ) {
|
||||
//if (title && image && kommentar && kategorie) {
|
||||
if (title && image && kommentar && kategorie) {
|
||||
const entry = new BlogEntry();
|
||||
entry.title = title;
|
||||
entry.image = image;
|
||||
@ -40,7 +40,7 @@ export class AppComponent {
|
||||
entry.menge = menge;
|
||||
entry.kommentar = kommentar;
|
||||
this.entries.push(entry);
|
||||
//}
|
||||
}
|
||||
}
|
||||
deleteAllEntries() {
|
||||
console.log(this.entries.length);
|
||||
|
@ -1,14 +1,20 @@
|
||||
import { BlogEntryComponent } from './blog-entry.component';
|
||||
import { BlogEntryComponent } from './components/blog-entry/blog-entry.component';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import { NavbarComponent } from './navbar/navbar.component';
|
||||
import { HeaderComponent } from './components/header/header.component';
|
||||
import { FooterComponent } from './components/footer/footer.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
BlogEntryComponent
|
||||
BlogEntryComponent,
|
||||
NavbarComponent,
|
||||
HeaderComponent,
|
||||
FooterComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
0
src/app/components/footer/footer.component.css
Normal file
0
src/app/components/footer/footer.component.css
Normal file
10
src/app/components/footer/footer.component.html
Normal file
10
src/app/components/footer/footer.component.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!-- footer -->
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<div class="content has-text-centered">
|
||||
<p>
|
||||
Made by Christian Greif - greifch67520@th-nuernberg.de - <a href="https://www.th-nuernberg.de/">Technische Hochschule Nürnberg</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
25
src/app/components/footer/footer.component.spec.ts
Normal file
25
src/app/components/footer/footer.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FooterComponent } from './footer.component';
|
||||
|
||||
describe('FooterComponent', () => {
|
||||
let component: FooterComponent;
|
||||
let fixture: ComponentFixture<FooterComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FooterComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FooterComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
15
src/app/components/footer/footer.component.ts
Normal file
15
src/app/components/footer/footer.component.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-footer',
|
||||
templateUrl: './footer.component.html',
|
||||
styleUrls: ['./footer.component.css']
|
||||
})
|
||||
export class FooterComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
0
src/app/components/header/header.component.css
Normal file
0
src/app/components/header/header.component.css
Normal file
5
src/app/components/header/header.component.html
Normal file
5
src/app/components/header/header.component.html
Normal file
@ -0,0 +1,5 @@
|
||||
<!-- header -->
|
||||
<header>
|
||||
<img src="https://ranking.zeit.de/che/images/logos/Hochschule_400.jpg">
|
||||
<app-navbar></app-navbar>
|
||||
</header>
|
25
src/app/components/header/header.component.spec.ts
Normal file
25
src/app/components/header/header.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HeaderComponent } from './header.component';
|
||||
|
||||
describe('HeaderComponent', () => {
|
||||
let component: HeaderComponent;
|
||||
let fixture: ComponentFixture<HeaderComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HeaderComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HeaderComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
11
src/app/components/header/header.component.ts
Normal file
11
src/app/components/header/header.component.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
templateUrl: './header.component.html',
|
||||
styleUrls: ['./header.component.css']
|
||||
})
|
||||
export class HeaderComponent implements OnInit {
|
||||
constructor() {}
|
||||
ngOnInit() {}
|
||||
}
|
0
src/app/navbar/navbar.component.css
Normal file
0
src/app/navbar/navbar.component.css
Normal file
23
src/app/navbar/navbar.component.html
Normal file
23
src/app/navbar/navbar.component.html
Normal file
@ -0,0 +1,23 @@
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<a class="navbar-brand" href="#">
|
||||
Menü
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button"
|
||||
(click)="toggleNavbar()">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse"
|
||||
[ngClass]="{ 'show': navbarOpen }">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Einkaufszettel 1</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Einkaufszettel 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
25
src/app/navbar/navbar.component.spec.ts
Normal file
25
src/app/navbar/navbar.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NavbarComponent } from './navbar.component';
|
||||
|
||||
describe('NavbarComponent', () => {
|
||||
let component: NavbarComponent;
|
||||
let fixture: ComponentFixture<NavbarComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ NavbarComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(NavbarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
21
src/app/navbar/navbar.component.ts
Normal file
21
src/app/navbar/navbar.component.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-navbar',
|
||||
templateUrl: './navbar.component.html',
|
||||
styleUrls: ['./navbar.component.css']
|
||||
})
|
||||
export class NavbarComponent implements OnInit {
|
||||
navbarOpen = false;
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
toggleNavbar() {
|
||||
this.navbarOpen = !this.navbarOpen;
|
||||
}
|
||||
ngOnInit(): void {
|
||||
this.navbarOpen = !this.navbarOpen;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user