limitTo、lowercase、uppercase

例子:

index.html

<div ng-app="myApp">
    <div ng-controller="firstController">
        <!--[1,2,3,4,5]-->
        <p>{{[1,2,3,4,5,6,7] | limitTo:5}}</p>

        <!--[3,4,5,6,7]-->
        <p>{{[1,2,3,4,5,6,7] | limitTo:-5}}</p>

        <!-- hello world -->
        <p>{{data.message | lowercase}}</p>
        <!-- HELLO WORLD -->
        <p>{{data.message | uppercase}}</p>
    </div>
</div>
<script src="//cdn.bootcss.com/angular.js/1.4.8/angular.js"></script>
<script type="text/javascript" src="app/index.js"></script>

app/index.js

angular.module('myApp',[])

.factory('Data',function(){

    return {
        message : 'Hello World'
    };
})

.controller('firstController',function($scope,Data,$filter){
   $scope.data = Data;

})

效果:

Last updated