Angularjs Summary (ii) filter use

Source: Internet
Author: User

HTML page:

1 <Table>2     <thead>3         <TR>4             <TDclass= "TD">Serial number</TD>5             <TDclass= "TD">Planning uses</TD>6         </TR>7     </thead>8     <tbody>9         <TRng-repeat= "FW in Fwlist">Ten             <TDclass= "TD"Ng-bind= "$index +1">1</TD> One             <TDclass= "TD">{{FW. Ghyt|name}}</TD> A         </TR> -     </tbody> - </Table>

Filter:

1define ([' angular '),function(ng) {2' Use strict ';3Ng.module (' Index-filters ', [])4 5. Filter (' Price ', [function () {6 7             return function(num) {8 9                 return' ¥ ' +num;Ten  One             }; A  -         }]) -. Filter (' Gender ', [function () { the  -             return function(gender) { -  -                 Switch(gender) { +  -                      Case1:returnMale; +  A                      Case2:returnFemale; at  -                      Case0:return‘‘; -  -                 } -  -             } in  -         }]) to. Filter (' NAME ', [function () { +  -             return function(YWLX) { the  *                 if(YWLX = =NULL)return""; $ Panax Notoginseng  -                 varstr =YWLX; the  +                 if(Ywlx.length > 10) { A  thestr = ywlx.substring (0, 10) + "..."; +  -                 } $                 returnstr; $  -             } -  the         }]) -. Filter (' Stateimgurl ', [function () {Wuyi  the             return function(state) { -  Wu                 Switch(state) { -  About                      Case' Normal ':return‘.. /img/normal.png '; $  -                      Case' Warning ':return‘.. /img/warning. PNG '; -  -                      Case' Overdue ':return‘.. /img/timeout.png '; A                 } +  the             } -  $         }]) the. Filter (' Ghyttoname ', [' Audit-service ',function(auditservice) { the             //Audit-service Service the             varTempData = []; theAuditservice.getparameter ("Housing use"). Success (function(sjlxlist) { -  inTempData =sjlxlist; the  the             }); About  the             return function(ID) { the                  for(vari = 0; i < tempdata.length; i++) { the  +                     if(Tempdata[i]. Code = =ID) { -  the                         returnTempdata[i]. Name;Bayi                     } the                 } the             } -         }]) -})

The required controller for the HTML page:

1 function (APP) {2     app.controller (' Index-controller ', [' $rootScope ', ' $scope ', ' $location ', ' $cookies ') , 3        function ($rootScope, $scope, $location, $cookies) {45       }]) 6 })

Angularjs Summary (ii) filter use

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.