Product-Alerts aus Tutorial übernommen
authorKai Moritz <kai@juplo.de>
Sat, 21 Dec 2019 11:18:09 +0000 (12:18 +0100)
committerKai Moritz <kai@juplo.de>
Sat, 21 Dec 2019 11:18:09 +0000 (12:18 +0100)
src/app/app.module.ts
src/app/product-alerts/product-alerts.component.css [new file with mode: 0644]
src/app/product-alerts/product-alerts.component.html [new file with mode: 0644]
src/app/product-alerts/product-alerts.component.spec.ts [new file with mode: 0644]
src/app/product-alerts/product-alerts.component.ts [new file with mode: 0644]
src/app/product-list/product-list.component.html

index a20e2d0..2bc4940 100644 (file)
@@ -6,13 +6,15 @@ import { AppComponent } from './app.component';
 import { TopBarComponent } from './top-bar/top-bar.component';
 import { ProductListComponent } from './product-list/product-list.component';
 import { ProductDetailsComponent } from './product-details/product-details.component';
+import { ProductAlertsComponent } from './product-alerts/product-alerts.component';
 
 @NgModule({
   declarations: [
     AppComponent,
     TopBarComponent,
     ProductListComponent,
-    ProductDetailsComponent
+    ProductDetailsComponent,
+    ProductAlertsComponent
   ],
   imports: [
     BrowserModule,
diff --git a/src/app/product-alerts/product-alerts.component.css b/src/app/product-alerts/product-alerts.component.css
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/app/product-alerts/product-alerts.component.html b/src/app/product-alerts/product-alerts.component.html
new file mode 100644 (file)
index 0000000..7ed54e8
--- /dev/null
@@ -0,0 +1,3 @@
+<p *ngIf="product.price > 700">
+  <button>Notify Me</button>
+</p>
diff --git a/src/app/product-alerts/product-alerts.component.spec.ts b/src/app/product-alerts/product-alerts.component.spec.ts
new file mode 100644 (file)
index 0000000..cbed753
--- /dev/null
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ProductAlertsComponent } from './product-alerts.component';
+
+describe('ProductAlertsComponent', () => {
+  let component: ProductAlertsComponent;
+  let fixture: ComponentFixture<ProductAlertsComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ ProductAlertsComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(ProductAlertsComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/src/app/product-alerts/product-alerts.component.ts b/src/app/product-alerts/product-alerts.component.ts
new file mode 100644 (file)
index 0000000..2b27eae
--- /dev/null
@@ -0,0 +1,17 @@
+import { Component, OnInit, Input } from '@angular/core';
+
+@Component({
+  selector: 'app-product-alerts',
+  templateUrl: './product-alerts.component.html',
+  styleUrls: ['./product-alerts.component.css']
+})
+export class ProductAlertsComponent implements OnInit {
+
+  @Input() product;
+
+  constructor() { }
+
+  ngOnInit() {
+  }
+
+}
index 91c9aea..68c054e 100644 (file)
@@ -11,4 +11,7 @@
   <button (click)="share()">
     Share
   </button>
+
+  <app-product-alerts [product]="product"></app-product-alerts>
+
 </div>