I'm trying to figure out how to use a set of if-else statements to dynamically change a value in the DOM using Angular JS.
The value I want to change is basketballpayout.basketballpay based on what the value of the team's total salary is (payout.grossprod)
Here's the code:
<html>
<head>
<link rel="stylesheet" type="text/css" href="index.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js" type="text/javascript"></script>
<script src="script.js" type="text/javascript"></script>
</head>
<body ng-app="Payout">
<form novalidate ng-controller="PayoutCtrl">
ENTER YOUR TEAM'S TOTAL SALARY <input type="text" name="Gross Production" placeholder="$" ng-model="payout.grossprod"><br />
ENTER YOUR CURRENT TEAM'S NET PAYOUT ACCOUNT <input type="text" name="Net Payout" placeholder="%" ng-model="payout.currentpay"><br />
<p >Current Payout: {{payout.currentpay}} %</p>
<p>Current Yearly Compensation: {{payout.grossprod * payout.currentpay / 100 | currency }}</p><br />
<p>basketball Payout: {{basketballpayout.basketballpay}} %</p>
</form>
var app = angular.module("Payout",[]);
app.controller("PayoutCtrl", function($scope) {
$scope.payout= {currentpay: 0, grossprod: 0};
$scope.basketballpayout= {basketballpay: "", basketballcom: 0, basketballdif: 0};
if ($scope.payout.grossprod === 0){
$scope.basketballpayout.basketballpay="0";
percent = 0;
} else if ($scope.payout.grossprod < 175000){
$scope.basketballpayout.basketballpay="20";
percent = 0.20;
} else if ($scope.payout.grossprod < 200000){
$scope.basketballpayout.basketballpay="25";
percent = 0.25;
} else {
$scope.basketballpayout.basketballpay="60";
percent = 0.60;
}
});
