Please use type and typescript.

Avijit Chakraborty
Citi Bank IFSC
Ireland


On Fri, Jul 17, 2020 at 9:59 PM Maureen Moore <[email protected]> wrote:

> I use the following function in my controller:
>
> sum = 0;
> total_price = 0;
>
>
> get grandTotal() {
> this.total_price = this.quantity * this.product_price;
> this.sum += this.total_price;
> return this.sum;
> }
>
>
>
>
> I get quantity and product_price from the onSubmit function:
>
> onSubmit(quantity, product_price){
> this.product_price = parseFloat(product_price);
> const data = {
>    quantity,
>    product_price
> };
> this.items.push(data);
> localStorage.setItem('items', JSON.stringify(this.items));
> }
>
>
>
>
> I display grandTotal with the following:
>
> <div> {{ grandTotal | currency:'USD':true }} </div>
>
>
>
> I get wild values for grandTotal and I get the error:  Error:
> ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after
> it was checked.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Angular and AngularJS discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/angular/3d753321-c8a5-49a0-8838-7e1152e54087o%40googlegroups.com
> <https://groups.google.com/d/msgid/angular/3d753321-c8a5-49a0-8838-7e1152e54087o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/CAP%3D6PQNOMhm4T40RCGREnR6r-C5EWinXJZ-kuCc5spM0oHg0LA%40mail.gmail.com.

Reply via email to