Math ng应用程序是否支持sin cos功能?如何
我希望有一个输入框,用户输入一个角度,hp将返回sin(角度)或cos(角度)的答案。我想使用ng应用程序 我能用+-做数学,但没有数学函数Math ng应用程序是否支持sin cos功能?如何,math,angularjs,Math,Angularjs,我希望有一个输入框,用户输入一个角度,hp将返回sin(角度)或cos(角度)的答案。我想使用ng应用程序 我能用+-做数学,但没有数学函数 我的用户如何键入角度并获得答案?您可以非常简单地做到这一点: HTML: 以下是JSFIDLE:在web搜索+100中找到good Look@TheHippo的函数并不难 <div ng-controller="AngleCtrl" ng-app> <div> Sin of <input ng-mode
我的用户如何键入角度并获得答案?您可以非常简单地做到这一点: HTML:
以下是JSFIDLE:在web搜索+100中找到good Look@TheHippo的函数并不难
<div ng-controller="AngleCtrl" ng-app>
<div>
Sin of <input ng-model="sinIn" /> is {{sinOut}}
</div>
<div>
Cos of <input ng-model="cosIn" /> is {{cosOut}}
</div>
<button ng-click="calculate()">Calculate</button>
</div>
function AngleCtrl($scope) {
$scope.sinIn = 0;
$scope.cosIn = 0;
$scope.calculate = function() {
$scope.sinOut = Math.sin($scope.sinIn);
$scope.cosOut = Math.sin($scope.cosIn);
};
$scope.calculate();
}