fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <meta charset="utf-8"> <script src="http://www.fmpq.com/jscss/jquery/1.4.6/angular.min.js"></script> <body> <div ng-app="myApp" ng-controller="myCtrl"> 姓名: {{ msg | reverse }} </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.msg = "Runoob"; }); app.filter('reverse', function() { //可以注入依赖 return function(text) { return text.split("").reverse().join(""); } }); </script> </body> </html>
运行结果