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,
--- /dev/null
+<p *ngIf="product.price > 700">
+ <button>Notify Me</button>
+</p>
--- /dev/null
+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();
+ });
+});
--- /dev/null
+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() {
+ }
+
+}
<button (click)="share()">
Share
</button>
+
+ <app-product-alerts [product]="product"></app-product-alerts>
+
</div>