<!doctype html><html ng-app><head> <meta charset="UTF-8" /> <title>Document</title> <script type="text/javascript" src="angular.min.js" ></script></head><body> <div ng-controller="c2_1"> 执行Javascript表达式:<br /> <input type="text" ng-model="expr1" /> <button ng-click="testExp1(expr1)">计算</button> <br /><br /> 执行Angular表达式:</br> <input type="text" ng-model="expr2" /> <span ng-bind="$eval(expr2)"></span> </div> <script type="text/javascript"> function c2_1($scope) { $scope.expr1=20; $scope.expr2='20+1|number:0'; $scope.testExp1=function(expr) { var newv=parseInt(expr)+1; console.log(newv); } } </script></body></html>
添加回答
举报
0/150
提交
取消