<!DOCTYPE html>
<html ng-app="App">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body ng-controller="Democtrl">
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var App = angular.module("App",[]);
App.controller("Democtrl",function($scope){
$scope.name ="jack";
//$scope.names ="aaack";
});
//第一个参数是自定的的名字 第二个参数是方法名
App.filter("tag",function(){
return function(msg){
//return msg.split("").reverse().join("");
return msg.charAt(0).toUpperCase();
}
});
</script>
<p>{{name | tag}}</p>
</body>
</html>
<html ng-app="App">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body ng-controller="Democtrl">
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var App = angular.module("App",[]);
App.controller("Democtrl",function($scope){
$scope.name ="jack";
//$scope.names ="aaack";
});
//第一个参数是自定的的名字 第二个参数是方法名
App.filter("tag",function(){
return function(msg){
//return msg.split("").reverse().join("");
return msg.charAt(0).toUpperCase();
}
});
</script>
<p>{{name | tag}}</p>
</body>
</html>