Angularjs can often see the ascending descending effect in the shopping cart

Source: Internet
Author: User

{"Xinxi":[    {"id": +, "name": "Baobo", "Age": 12},    {"id": "Name": "Paopo", "Age": 18},    {"id": "Name": "Xinxin", "Age": 55},    {"id": "Name": "Angular", "age": 20},    {"id": "Name": "Chali", "Age": 15},    {"ID": $, "name": "Each", "age": 60},    {"ID": 98, "name": "Hello", "age": 19},    {"id": "28", "Name": "Zizizi", "Age":},    {"id": "56", "Name": "GeGeGe", "Age":},    {"id": Fufuf, "name": "43", "Age":},    {"id": "Name": "Baobo", "Age": 12},    {"id": Si, "name": "Menmen", "Age": 32},    {"id": 71, "name": "QQQQ", "Age":},    {"id": Laowang, "name": "22", "Age":},    {"id": +, "name": "Wangwang", "Age": 99},    {"id": 1, "name": "Dadad", "Age": 88}    ]}

Create a JSON array

Gets the contents of the array to display the page

1 <!DOCTYPE HTML>2 <HTMLNg-app= "ATR">3     <Head>4         <MetaCharSet= "UTF-8">5         <title></title>6         <Scriptsrc= "Angular.min.js"></Script>7         <Script>8             varapp=Angular.module ('ATR',[]);//Create a module9 App.controller ('Test',function($scope, $http) {//Creating a controller test $http fetching JSON dataTen $http. Get ('Data.json'). Success (function(data) { One $scope. Arr=data; A $scope. Selprop="ID"; - $scope. SelBy=1; -                 }) the             }) -         </Script> -     </Head>  -     <BodyNg-controller= "Test"> +         <Selectname=""Ng-model= "Selprop"> -             <optionvalue= "id">Sort by number</option><!--value is the first one to find the array subscript - +             <optionvalue= "Name">Name sort</option> A             <optionvalue= "Age">Age sequencing</option> at         </Select> -         <Selectname=""Ng-model= "SelBy"> -             <optionvalue= "1">Ascending</option><!--Ascending is indicated by 1 - -             <optionvalue= "-1">Descending</option> -         </Select> -         <inputtype= "text"placeholder= "Search Content"Ng-model= "value"/> in         <TableBorder= "1"cellspacing= "0"cellpadding= "0"> -             <TR> to                 <th>Number</th> +                 <th>Name</th> -                 <th>Age</th> the             </TR>                        <!--Filtering Filter - <!--sorted array Three mesh conditions - *             <TRng-repeat= "value in Arr | filter:value | orderby:selby = = 1? Selprop: '-' + selprop"> $                 <TD>{{Value.id}}</TD>Panax Notoginseng                 <TD>{{Value.name}}</TD> -                 <TD>{{Value.age}}</TD> the             </TR> +         </Table> A     </Body> the </HTML>

Open the page and you'll see the effect.

Angularjs can often see the ascending descending effect in the shopping cart

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.