Skip to content

Instantly share code, notes, and snippets.

@carlosmoretti
Created October 12, 2019 02:22
Show Gist options
  • Select an option

  • Save carlosmoretti/ca1ab5aef64476d2866ec2627be4affd to your computer and use it in GitHub Desktop.

Select an option

Save carlosmoretti/ca1ab5aef64476d2866ec2627be4affd to your computer and use it in GitHub Desktop.
import { Component, OnInit, Input, OnChanges } from '@angular/core';
@Component({
selector: 'app-calculadora',
templateUrl: './calculadora.component.html',
styleUrls: ['./calculadora.component.css']
})
export class CalculadoraComponent implements OnInit, OnChanges {
@Input('valor1') valor1: number;
@Input('valor2') valor2: number;
resultado: number;
constructor() {
}
ngOnChanges() {
this.resultado = this.valor1 + this.valor2;
}
ngOnInit() {
}
ShowNumber() {
if(!Number.isNaN(this.resultado))
return this.resultado;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment