<!doctypehtml><htmllang="en"><head><metacharset="UTF-8"><title>test</title><scriptsrc="js/angular.js"></script><scripttype="application/javascript">(function(angular){'usestrict';angular.module('myApp',[]).controller('firstController',functionfirstController(){this.firstNum=1;this.secondNum=1;this.doSum111=function(){returnthis.firstNum+this.secondNum;};});})(window.angular);</script></head><body><divng-app="myApp"><divng-controller="firstControllerasfc"><!--ControllerAs语法,简单说就是可以在Controller中使用this来替代$scopefc就相当于this了--><inputtype="number"name="firstNum"ng-model="fc.firstNum"required/>+<inputtype="number"name="secondNum"ng-model="fc.secondNum"required/>={{fc.doSum111()}}</div></div></body></html>