angularjs--Shopping Cart Select All/Cancel all Select function

Source: Internet
Author: User
Tags button type

Just learning angularjs, so practice wrote a shopping cart similar to the full selection/cancellation of the full selection of functions, the main implementation of the functions are:

1, tick Select all checkbox, list data are checked, cancel the same, with Ng-model to achieve two-way binding;

2, select all the checkboxes in the list, the selection will also be checked; (Here I think of the method is to add the checked field for each object, and then tick the trigger Echochange () function, with a CC variable to calculate the current checked is true number, Then you can determine whether the selected number is equal to the length of the array, and the equivalent is all checked, so the Select button is also assigned true; don't know if there's a simpler way? Please tell me the message, thank you! )

3, all check, as long as the cancellation of a full select check status is false;

4, the realization of the shopping cart subtotal and the total amount of calculation, only to calculate the goods that are checked;

There are problems to be perfected:

1, quantity I used the type= "number", set the min=10, but manually entered the value is not limited, so if the manual input will have illegal values;

2, delete the product function I just used the pop () method, remove the last array element, the actual should be deleted for each commodity object;

3, select All/Cancel the full selection should have more rigorous methods, to be perfected;

Attached:

Attached code:

<! DOCTYPE html>

  

If the above code has a problem or you have better suggestions, you are welcome to contact me, thank you.

angularjs--Shopping Cart Select All/Cancel all Select function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.