I'm using AngularJS framework.
I have a text box to enter an amount and a drop down to select a type.
<input type="text" ng-model="user.amount"/>
<select ng-model="user.rateType">
<option> rate </option>
<option> unrate</option>
</select>
<input type="text" ng-model="user.assignVal"/>
Here is my controller
var app = angular.module("myApp", []);
app.controller("myCtrl", function ($scope) {
$scope.Main = [
{ id: "1", hval: 1000, lval: 5000, type: "rate", cal: "20" },
{ id: "2", hval: 6000, lval: 10000, type: "rate", cal: "50" },
{ id: "3", hval: 1000, lval: 5000, type: "unrate", cal: "100" },
{ id: "4", hval: 6000, lval: 10000, type: "unrate", cal: "100" },
];
console.log($scope.user.assignVal);
});
The user enter an amount in the text-box and select the rate type. I need to find the element fulfilling the following conditions :
- the user selected type matches item
type - the amount entered by the user is in the range delimited by
hvalandlval
For example,
- User enters 1100 as amount and select
ratetype,calequals 20 - User enters 6500 as amount and select
ratetype,calequals 50 - User enters 1100 as amount and select
unratetype,calequals 100
How can I achieve this ?
get request
$scope.loadShareSetting = function (){
$http({
method: "GET",
headers: { 'Content-Type': 'application/json','Authorization': 'Bearer ' + localStorage.getItem('JWT_TOKEN')},
url: appConfig.apiUrl + "/residence-settings",
}).then(function (response) {
$scope.residenceSetting = response.data;
}, function (response) {
});
}