import { Component , OnInit , Input , EventEmitter , Output , OnChanges } from '@angular/core' ; import { RequirementItem } from "../models/requirement-item.interface" ; @ Component ( { selector : 'ws-requirements-card' , templateUrl : './requirements-card.component.html' , styleUrls : [ './requirements-card.component.sass' ] } ) export class RequirementsCardComponent implements OnInit , OnChanges { private _allMet : boolean ; @ Input ( ) requirements : RequirementItem [ ] = [ ] ; @ Output ( ) allMetChange = new EventEmitter ; constructor ( ) { } ngOnChanges ( ) { for ( let requirement of this . requirements ) { if ( ! requirement . met ) { this . allMet = false ; return ; } } this . allMet = true ; } ngOnInit ( ) { } set allMet ( newValue ) { this . _allMet = newValue ; this . allMetChange . emit ( newValue ) ; } }