import { Component , OnInit } from '@angular/core' ; @ Component ( { selector : 'helper-water-hardness' , templateUrl : './helper-water-hardness.component.html' , styleUrls : [ './helper-water-hardness.component.scss' ] , } ) export class HelperWaterHardnessComponent implements OnInit { public waterhardness : any = { ca : 0 , mg : 0 } ; constructor ( ) { } public ngOnInit ( ) { } public getTotalHardness ( ) { try { const hardness = ( 0.02495 * this . waterhardness . ca ) + 0.04114 * ( this . waterhardness . mg ) ; return hardness . toFixed ( 2 ) ; } catch ( ex ) { return 0 ; } } public getGermanHardness ( ) { try { const hardness = ( ( this . waterhardness . ca * 1.4 ) + ( this . waterhardness . mg * 2.307 ) ) / 10 ; return hardness . toFixed ( 2 ) ; } catch ( ex ) { return '0' ; } } }