Save value to a variable

1

How can I save the value of a calculation made on the front end to a variable in typescript, for example:

Typescript:

valor:number=0;

html:

<ion-input type="number" [(ngModel)]="valor"></ion-input>
<p>{{valor * valor}}</p>

In typescript only the value that was typed in the input is stored, what I need is to put in a variable the calculation made by the paragraph: <p>{{valor * valor}}</p>

I tried the following logic without success:

Typescript:

this.result = this.valor * this.valor;

html: <p>{{result}}</p>

    
asked by anonymous 05.05.2017 / 03:02

0 answers