javascript - How can I use an AngularJS filter to format a number to have leading zeros? -


i checked document

http://docs-angularjs-org-dev.appspot.com/api/ng.filter:number

but it's still not clear me. numbers have 4 digits , leading zeros.

22 > 0022 1  > 0001 

can , tell me if possible number or kind of filter?

no filter required, use expression in html

{{("00000"+1).slice(-6)}}      // '000001'  {{("00000"+123456).slice(-6)}} // '123456' 

Comments