Angular JS Magazine

vineri, 19 septembrie 2014

Working with lowercase and uppercase Filters

This tip shows you how to deal with lowercase and uppercase buil-in filters:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script src="../angular/angular.min.js"></script>
    <link href="../bootstrap/css/bootstrap.css" rel="stylesheet" />
    <link href="../bootstrap/css/bootstrap-theme.css" rel="stylesheet" />
</head>
<body>
<div ng-app="" ng-init="atp=[
     { name: 'Nadal, Rafael', country: 'Spain', rank: 1},
     { name: 'Djokovic, Novak', country: 'Serbia' , rank: 2},
     { name: 'Federer, Roger', country: 'Switzerland' , rank: 3},
     { name: 'Wawrinka, Stan', country: 'Switzerland' , rank: 4},
     { name: 'Ferrer, David', country: 'Spain', rank: 5}]">

    <div id="atpPanel" class="panel">
        <h3 class="panel-header">ATP SINGLES RANKINGS</h3>
        <table class="table">
            <thead>
            <tr>
                <th>Name</th>
                <th>Rank</th>
                <th>Country</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="item in atp">
                <td>{{item.name | uppercase}}</td>
                <td>{{item.rank}}</td>
                <td>{{item.country | lowercase}}</td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
</body>
</html>