EmberJs Calculate the total amount

TamilG

I'm beginner in Emberjs,

I want to calculate the total amount in the added item list.

For example:

(03) items added in list
------------------------
Item-1  3,000.00
Item-2  4,000.00
Item-3  3,000.00
-------------------------
Total  10,000.00    Print
-------------------------

How to create the view and controller in emberjs for calculate the total amount?

How to create the PDF file and print the same output as PDF format?

Thanks advance. :)

vine77

The aggregation methods in Ember.Enumerables are handy for this type of thing. I've created a jsBin demonstrating how to use reduce() in this case. You can create a computed property for the total on your controller that sums the values of each record in your model. Note that passing 0 as the second parameter (initialValue) will seed reduce() with an integer and help you avoid the string concatenation issues you were seeing.

  total: function () {
    return this.get('model').reduce(function (previousValue, item, index, enumerable) {
      return previousValue + item.value;
    }, 0);
  }.property('model.@each')

(Your second question is unrelated, but you might want to take a look at jsPDF.)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Get woocommerce carts total amount

From Dev

Calculate amount on the basis of semiannual

From Dev

Calculate sub total emberjs

From Dev

How to calculate % of total in MySQL

From Dev

mssql calculate total by hour

From Dev

Getting total amount in a column

From Dev

Django / Python: Calculate total amount of item in django template

From Dev

How to calculate the total amount when checkbox is cheked and item added to cart?

From Dev

Get total Amount of the column in AngularJs

From Dev

Get total amount of JavaScript form

From Dev

MySQL: Rank the total total amount with COUNT()

From Dev

How to calculate total paid amount for each id in various stages and reducing the paid amount after each stage in SQL Server 2012

From Dev

How to calculate the total amount of hours and minutes (in a specific range) between a timestamp range

From Dev

Calculate amount of iterations

From Dev

SQL command to calculate from Amount and ID, total weight

From Dev

Calculate the total amount of cache being used in all apps android?

From Dev

Calculate sub total emberjs

From Dev

Calculating total amount

From Dev

Calculating total amount from nouisliders

From Dev

jQuery day and amount calculate?

From Dev

how to calculate total amount of Jenkin's jobs

From Dev

Calculate the amount and put the total where the x is not presented in VBA

From Dev

Failing to calculate amount

From Dev

How to calculate total amount of childs and show in parent using angular

From Dev

select total bill amount at monthwise

From Dev

MySQL: possible to calculate the total inventory cost based on amount per received order?

From Dev

Unable to get total amount payable

From Dev

textbox related queries get all input details and calculate total amount

From Dev

jquery calculate total amount of bill

Related Related

  1. 1

    Get woocommerce carts total amount

  2. 2

    Calculate amount on the basis of semiannual

  3. 3

    Calculate sub total emberjs

  4. 4

    How to calculate % of total in MySQL

  5. 5

    mssql calculate total by hour

  6. 6

    Getting total amount in a column

  7. 7

    Django / Python: Calculate total amount of item in django template

  8. 8

    How to calculate the total amount when checkbox is cheked and item added to cart?

  9. 9

    Get total Amount of the column in AngularJs

  10. 10

    Get total amount of JavaScript form

  11. 11

    MySQL: Rank the total total amount with COUNT()

  12. 12

    How to calculate total paid amount for each id in various stages and reducing the paid amount after each stage in SQL Server 2012

  13. 13

    How to calculate the total amount of hours and minutes (in a specific range) between a timestamp range

  14. 14

    Calculate amount of iterations

  15. 15

    SQL command to calculate from Amount and ID, total weight

  16. 16

    Calculate the total amount of cache being used in all apps android?

  17. 17

    Calculate sub total emberjs

  18. 18

    Calculating total amount

  19. 19

    Calculating total amount from nouisliders

  20. 20

    jQuery day and amount calculate?

  21. 21

    how to calculate total amount of Jenkin's jobs

  22. 22

    Calculate the amount and put the total where the x is not presented in VBA

  23. 23

    Failing to calculate amount

  24. 24

    How to calculate total amount of childs and show in parent using angular

  25. 25

    select total bill amount at monthwise

  26. 26

    MySQL: possible to calculate the total inventory cost based on amount per received order?

  27. 27

    Unable to get total amount payable

  28. 28

    textbox related queries get all input details and calculate total amount

  29. 29

    jquery calculate total amount of bill

HotTag

Archive