How to display only 2 decimal point in output of angularJS.
Supppose my percentage is 81.6777776777 % but i want to display it 81.67 % .
My code of angularJS:
Controller.js
- app.controller("AngularJs_ImageController", function ($scope, $timeout, $rootScope, $window, $http, myService) {
-
- $scope.finalSubmit = function () {
- $http({
- method: 'POST',
- url: '/Exam/FinalSubmit/'
-
- });
-
- $scope.txtAnswer = "";
- var percentage = ($scope.totalPoints * 100) / $scope.textbox;
- $scope.Resuts1 = "You gotted " + percentage + " %";
- if (percentage >= 70) {
- $scope.Resuts = "You are Pass " + $scope.Resuts1;
-
- swal("Pass", "You are Pass " + $scope.Resuts1, "success")
- $scope.ImageAnswer = "won.png";
- }
- else {
- $scope.Resuts = "Sorry " + $scope.usrName + " You are Fail " + $scope.Resuts1;
-
- swal("Fail", "You are fail " + $scope.Resuts1, "error")
-
- $scope.ImageAnswer = "lose.png";
- }
-
- $scope.showGameStart = false;
- $scope.showGame = false;
- $scope.showresult = true;
- return;
- return;
- }
-
- )};
in view Result.cshtml
- <div ng-show="showresult">
- <p> {{Resuts}} </p>
- </div>
Output is:
Sorry Rajesh You are Fail, You gotted %
But i want to display this to: 42.85 % , How is possible in angularJS.
Thanx in advance