首页 > 其他 > 详细

Angular 学习笔记——filter

时间:2015-11-23 22:00:55      阅读:261      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script type="text/javascript" src="js/angular-1.3.0.js"></script>
    <script>
        var m1 = angular.module(‘myApp‘,[]);
        
        m1.filter(‘firstUpper‘,function(){
            return function (str){
                return str.charAt(0).toUpperCase() + str.substring(1);
            }
        })
        m1.controller(‘may‘,[‘$scope‘,‘$filter‘,function($scope,$filter){
            $scope.name = $filter(‘firstUpper‘)(‘hello‘);

        }])
    </script>
</head>
<body ng-controller=‘may‘>
    <p>{{name }}</p>
</body>
</html>

 

Angular 学习笔记——filter

原文:http://www.cnblogs.com/mayufo/p/4989722.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!