How to get price from AJAX - javascript

I'm on a problem for few time ! I've a payment thing, where I use AJAX (to change the price directly when the user change a select), but the problem is, I don't know how to get the price (and verify it's the good price) to insert into the paypal Payment ! I tryed session with PHP etc.. But the price value wasn't changing :/
Index.php:
<div class="col-lg-12 animated fadeIn">
<div class="col-sm-6 col-md-6 col-lg-3 order-actual-rank">
<p>Rang actuel</p>
<img id="current_league_img" src="assets/img/tiers/silver.png" alt="Silver" class="order-rank-img">
<div>
<select name="order-division-actual_league" class="form-control" id="actual_league" onChange="changeCurrentLeague(); getDivPrice()">
<option value="Bronze">Bronze</option>
<option value="Silver" selected>Silver</option>
<option value="Gold">Gold</option>
<option value="Platinum">Platinum</option>
<option value="Diamond">Diamond</option>
</select>
</div>
<div>
<select name="order-division-actual_division" onchange="getDivPrice()" id="actual_division" class="form-control">
<option value="1">I</option>
<option value="2">II</option>
<option value="3">III</option>
<option value="4">IV</option>
<option value="5" selected>V</option>
</select>
</div>
</div>
<div class="col-sm-6 col-md-6 col-lg-3 order-desired-rank">
<p>Rang désiré</p>
<img id="desired_league_img" src="assets/img/tiers/gold.png" alt="Gold" class="order-rank-img">
<div>
<select name="order-division-desired_league" onchange="changeDesiredLeague(); getDivPrice()" id="desired_league" class="form-control" id="desired_league">
<option value="Bronze">Bronze</option>
<option value="Silver">Silver</option>
<option value="Gold" selected>Gold</option>
<option value="Platinum">Platinum</option>
<option value="Diamond">Diamond</option>
</select>
</div>
<div>
<select name="order-division-desired_division" onchange="getDivPrice()" id="desired_division" class="form-control">
<option value="1">I</option>
<option value="2">II</option>
<option value="3">III</option>
<option value="4">IV</option>
<option value="5" selected>V</option>
</select>
</div>
</div>
<div class="col-sm-12 col-md-12 col-lg-6 order-division-order">
<ul>
<li>Division : <span id="division_infos"></span></li>
<li>Prix : <span id="boost_price"></span></li>
</ul>
<select name="order-division-server" class="form-control" style="width: 100px; margin-top: 10px;">
<option value="euw" selected>EUW</option>
<option value="eune">EUNE</option>
</select>
<input type="checkbox" onchange="getDivPrice()" id="order-duo" name="order-division-duo" style="height: 20px; width: 20px; vertical-align: top;">
<label for="order-duo">Duo</label>
<div id="paypal-button" class="form-paypal">
</div><script type="text/javascript" src="assets/js/checkout.js"></script>
console.log(data);
paypal.Button.render({
env: 'sandbox', // Or 'sandbox'
style: {
label: 'generic',
size: 'small', // small | medium | large | responsive
shape: 'rect', // pill | rect
color: 'gold', // gold | blue | silver | black
tagline: false
},
client: {
sandbox: 'AYh_cbrBW8_Ic8QLBh_hXPLpzbzFqc4_ckRsnH3cZ60oxheTz3CdZOgxlPK4TMDBF-ZiUR4EomVHMAkx',
production: ''
},
commit: true,
payment: function(data, actions) {
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '0.01', currency: 'EUR' }
}
]
}
});
},
onAuthorize: function(data, actions) {
return actions.payment.execute().then(function(payment) {
alert("Payement effectué");
});
}
}, '#paypal-button');
AJAX :
function getDivPrice() {
var price = 0;
var actual_league = document.getElementById("actual_league").value;
var actual_division = document.getElementById("actual_division").value;
var desired_league = document.getElementById("desired_league").value;
var desired_division = document.getElementById("desired_division").value;
var dataString = 'type=division&actual_league=' + actual_league +
"&actual_division=" + actual_division + "&desired_league=" + desired_league +
"&desired_division=" + desired_division;
$.ajax({
type: 'POST',
data: dataString,
url: '/FoxBoost/assets/getprice.php',
success: function (data) {
var duoqstr = "";
if (document.getElementById('order-duo').checked)
{
data = data * 1.3;
duoqstr = " en Duo"
data = data.toFixed(2);
}
if(data == 0)
{
document.getElementById('boost_price').innerHTML = "";
document.getElementById('division_infos').innerHTML = "Ce boost n'est pas possible.";
document.getElementById('hidden_price').value = data;
}else{
document.getElementById('boost_price').innerHTML = data + " €";
document.getElementById('division_infos').innerHTML = actual_league + " " + actual_division + " " + "->" + " " + desired_league + " " + desired_division + duoqstr;
document.getElementById('hidden_price').value = data;
}
}
});
}
getPrice.php
<?php
$tiers = array(
"Bronze 5" => 0,
"Bronze 4" => 1,
"Bronze 3" => 2,
"Bronze 2" => 3,
"Bronze 1" => 4,
"Silver 5" => 5,
"Silver 4" => 6,
"Silver 3" => 7,
"Silver 2" => 8,
"Silver 1" => 9,
"Gold 5" => 10,
"Gold 4" => 11,
"Gold 3" => 12,
"Gold 2" => 13,
"Gold 1" => 14,
"Platinum 5" => 15,
"Platinum 4" => 16,
"Platinum 3" => 17,
"Platinum 2" => 18,
"Platinum 1" => 19,
"Diamond 5" => 20,
"Diamond 4" => 21,
"Diamond 3" => 22,
"Diamond 2" => 23,
"Diamond 1" => 24
);
$costs = array(
10,10,10,10,12,
12,13,14,15,18,
18,20,22,24,28,
30,33,36,39,45,
65,75,85,125
);
if($_POST['actual_league'] != null && $_POST['actual_division'] != null && $_POST['desired_league'] != null && $_POST['desired_division'] != null) {
$actual = $_POST['actual_league']." ".$_POST["actual_division"];
$desired = $_POST['desired_league']." ".$_POST["desired_division"];
foreach($tiers as $index => $key) {
if($actual === $index) {
$actual = $key;
}
if($desired === $index) {
$desired = $key;
}
}
$price = 0;
if ($actual < $desired) {
for ($i = $actual ; $i < $desired ; $i++) {
$price += $costs[$i];
}
echo $price;
}else{
echo $price;
}
}else{
header('Location: /foxboost');
}
?>

Related

Populating value from an object array to multiple (pre)selected option in Vue.JS

I Try to add the value of (pre)selected options into the multiple dropdowns but I get only the first value rendered.
I try to add data below into multiple select>options, but I got only first(same) value from input and quidoId on every input/quidoId value
stationButtons: [
{
"buttonId": 1,
"quidoId": "101",
"input": "11"
},
{
"buttonId": 2,
"quidoId": "102",
"input": "22"
},
{
"buttonId": 3,
"quidoId": "103",
"input": "33"
},
{
"buttonId": 4,
"quidoId": "104",
"input": "44"
}
]
Output values
I got this issue because I got every dropdown rendered dynamically because I got values(options to choose from) from API. Here is a sample of the code where I render the quidoId(TEST 101) and input(11).
<tr
v-for="(btn, index) in filteredButtonList"
v-bind:key="btn.id"
style="border: 1px solid #6b6b6b; font-size: 14px; width: 100%"
>
<td>{{ btn.buttonListName }}</td>
<td>{{ btn.buttonListDesc }}</td>
<td>
<select
#change="onQuidoIdChange($event)"
class="form-select form-control required"
v-bind:id="index + 1"
style="border: 1px solid #6b6b6b"
>
<option
class="quido-id"
v-for="entry in selectedQuidoId"
:value="entry.quidoId"
selected
disabled
hidden
:key="entry.quidoId"
>
{{ entry.quidoName }}
</option>
<option
v-for="quido in filteredQuidosList"
:value="quido.quidoId"
v-bind:key="quido.quidoId"
v-bind:id="quido.quidoId"
>
{{ quido.quidoName }}
</option>
</select>
</td>
<td>
<tr>
<td>
<input
#change="onInputChange($event)"
type="number"
class="input-custom"
:placeholder="`Input ${index + 1} `"
v-for="input in selectedInput"
:value=input.input
v-bind:id="index + 1"
v-bind:key="input.input"
style="font-size: 12px; border: 1px solid #6b6b6b; text-align: center"
/>
</td>
</tr>
</td>
</tr>
SCRIPT TAG
<script>
export default {
inheritAttrs: false,
data() {
return {
index: 0,
station: {
line: "",
physLine: "",
wsType: "",
ws: "",
name: "",
desc: null,
isValid: true,
order: "",
stationGroupId: "",
stationButtons: [],
},
editIsClicked: false,
deleteIsClicked: false,
selectedQuidoId: [],
selectedStationGroupId: [],
selectedInput: [],
};
},
props: [
"id",
"lineNum",
"physLine",
"wsType",
"ws",
"name",
"isValid",
"stationGroupId",
"stationGroupName",
"order",
],
computed: {
filteredStations() {
return this.$store.getters["stations/stations"];
},
filteredButtonList() {
return this.$store.getters["stations/buttonListGetter"];
},
filteredQuidosList() {
return this.$store.getters["stations/quidosListGetter"];
},
filteredStationGroups() {
return this.$store.getters["stations/stationGroups"];
},
filteredStationButtons() {
return this.$store.getters["stations/stationButtonsGetter"];
},
},
methods: {
editStation(event) {
this.editIsClicked = !this.editIsClicked;
let idFromClickedButton = parseInt(event.target.id);
let idFromStationListResultsId = this.filteredStations.value.find(
(el) => el.id === idFromClickedButton
);
if (idFromStationListResultsId) {
this.station = idFromStationListResultsId;
} else {
alert("This ID does not exist");
}
let quidoFromStationListResults = idFromStationListResultsId.stationButtons;
let quidoForEditing = quidoFromStationListResults.find((el) => el.quidoId);
let quidoFromOriginalArr = this.filteredQuidosList.find(
(el) => el.quidoId === quidoForEditing.quidoId
);
if (quidoFromOriginalArr) {
this.selectedQuidoId.push(quidoFromOriginalArr);
}
let inputFromStationListResults = idFromStationListResultsId.stationButtons;
let inputForEditing = inputFromStationListResults.find((el) => el.input);
if (inputForEditing) {
this.selectedInput.push(inputForEditing);
}
let stationGroupsIdFromStationListArr = idFromStationListResultsId.stationGroupId;
let stationGroupIdFromStationGroupslArr = this.filteredStationGroups.find(
(el) => el.stationGroupsId == stationGroupsIdFromStationListArr
);
if (stationGroupsIdFromStationListArr) {
this.selectedStationGroupId.push(stationGroupIdFromStationGroupslArr);
} else {
alert("This Id does not exist!");
}
},
},
};
</script>
I need only help with the logic behind this solution, how to assign every value to every dropdown?
If I missed some important information which can help please let me know, I will be glad to share more.
CODE SANDBOX EXAMPLE

Dependent Dropdown list in Javascript, jQuery, Json & Ajax

How can I make it so when I select an option it will only populate that one area?
I only want the specific places in that area.
example picture.]
Example of the output (1)
Example of the output (2)
this is the json code that I want to have a function and connect the two or more files.
json file 1
{
"code": "010000000",
"name": "Ilocos Region",
"altName": "Region I"
}
json file 2
{
"code": "012800000",
"name": "Ilocos Norte",
"altName": null,
"region": "010000000"
},
{
"code": "012900000",
"name": "Ilocos Sur",
"altName": null,
"region": "010000000"
},
{
"code": "013300000",
"name": "La Union",
"altName": null,
"region": "010000000"
},
{
"code": "015500000",
"name": "Pangasinan",
"altName": null,
"region": "010000000"
}
here is the code
html part
<div class="container form-group" style="width:600px; margin-top: 10vh">
<form action="" method="GET" id="addform">
<div class="form-group">
<select name="region" id="region" class="form-control input-sm" required>
<option value="">Select Region</option>
</select>
</div>
<div class="form-group">
<select name="province" id="province" class="form-control input-sm" required>
<option value="">Select Province</option>
</select>
</div>
</form>
</div>
<script>
$(function(){
let regionOption;
let provinceOption;
//FOR REGION
$.getJSON('regions.json', function(result){
regionOption += `<option value="">Select Region</option>`;
$.each(result, function(i, region){
regionOption += `<option value='${region.code}'> ${region.altName}</option>`;
});
$('#region').html(regionOption);
});
//FOR PROVINCE
$('#region').change(function(){
$.getJSON('provinces.json', function(result){
provinceOption += `<option value="">Select Province</option>`;
$.each(result, function(region, province){
provinceOption += `<option value='${province.name}'> ${province.name}</option>`;
});
$('#province').html(provinceOption);
});
});
});
</script>
my failed attempt is this part :
$('#region').change(function(){
if($(this).val() === $(this).val()){
$.getJSON('provinces.json', function(result){
provinceOption += `<option value="">Select Province</option>`;
$.each(result, function(region, province){
provinceOption += `<option value='${province.name}'> ${province.name}</option>`;
});
$('#province').html(provinceOption);
});
}
});
You can use .filter() to filter your json return inside ajax then inside this compare value of select-box with all values of region if they matches get that data . Finally loop through filter datas and show them inside your select-box.
Demo Code :
//just for demo :)
var result = [{
"code": "010000000",
"name": "Ilocos Region",
"altName": "Region I"
}, {
"code": "010000002",
"name": "Ilocos Region2",
"altName": "Region 2"
}]
var json2 = [
{
"code": "012800000",
"name": "Ilocos Norte",
"altName": null,
"region": "010000000"
},
{
"code": "012900000",
"name": "Ilocos Sur",
"altName": null,
"region": "010000000"
},
{
"code": "013300000",
"name": "La Union",
"altName": null,
"region": "010000002"
},
{
"code": "015500000",
"name": "Pangasinan",
"altName": null,
"region": "010000002"
}
]
$(function() {
let regionOption;
let provinceOption;
//FOR REGION
/* $.getJSON('regions.json', function(result) {*/
regionOption += `<option value="">Select Region</option>`;
$.each(result, function(i, region) {
regionOption += `<option value='${region.code}'> ${region.altName}</option>`;
});
$('#region').html(regionOption);
/* });*/
$('#region').change(function() {
var values = $(this).val()
var provinceOption = ""
/*$.getJSON('provinces.json', function(json2) {*/
//filter your json return..
var items = $(json2)
.filter(function(i, n) {
return n.region === values; //get value where region is same
});
provinceOption += `<option value="">Select Province</option>`;
//loop through dates
$.each(items, function(region, province) {
provinceOption += `<option value='${province.name}'> ${province.name}</option>`;
});
$('#province').html(provinceOption);
/* });*/
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.min.js"></script>
<div class="container form-group" style="width:600px; margin-top: 10vh">
<form action="" method="GET" id="addform">
<div class="form-group">
<select name="region" id="region" class="form-control input-sm" required>
<option value="">Select Region</option>
</select>
</div>
<div class="form-group">
<select name="province" id="province" class="form-control input-sm" required>
<option value="">Select Province</option>
</select>
</div>
</form>
</div>

How can I fill a probably infinite amount of dropdowns iterating through objects from a JSON file?

So, I'm trying to fill three separate dropdown menus (could end up being more) with objects pulled from different JSON files depending on the selection from each dropdown. So first selection fills the second one, and so on.
These are the dropdown menus:
<form>
<div>
<select id="level1">
<option selected value="base">Please select one</option>
<option value="first-option">First one</option>
<option value="second-option">Second one</option>
</select>
</div>
<div>
<select id="level2" class="form-control">
<option selected value="base">Please select one</option>
</select>
</div>
<div>
<select id="level3" class="form-control">
<option selected value="base">Please select one</option>
</select>
</div>
<div id="submit">
<button type="submit">Go</button>
</div>
</form>
This is a sample JSON file:
{
"first_option": {
"me": "first_option",
"COD_REF": "MX09017CL01AP",
"TITLE": "First Option",
"children": {
"child01": {
"me": "child01",
"COD_REF": "001",
"TITLE": "Child 1",
"children": {
"grandchild01": {
"me": "grandchild01",
"TITLE": "Grandchild 1"
},
"grandchild02": {
"me": "grandchild01",
"TITLE": "Grandchild 1"
}
}
}
},
"child02": {
"me": "child02",
"COD_REF": "002",
"TITLE": "Child 2",
"children": {
"grandchild01": {
"me": "grandchild01",
"TITLE": "Grandchild 1"
},
"grandchild02": {
"me": "grandchild01",
"TITLE": "Grandchild 1"
}
}
},
}
}
The solution I came up with works just fine. The thing is I could probably do with some iteration, I just don't know how to do it. Here's an abridged version of what I have:
var vals = [];
var $level1 = $("#level1");
var $level2 = $("#level2");
var $level3 = $("#level3");
function generateTable(info) {
$(".COD_REF").innerHTML(info.COD_REF);
$(".TITLE").innerHTML(info.TITLE);
};
function generateTable2(info) {
$(".COD_REF").innerHTML(info.COD_REF);
$(".TITLE").innerHTML(info.TITLE);
}
function generateTable3(info) {
$(".COD_REF").innerHTML(info.COD_REF);
$(".TITLE").innerHTML(info.TITLE);
}
//first dropdown
$("#level1").change(function () {
var $dropdown = $(this);
var key = $dropdown.val();
function generateDropdown(vals) {
$level2.append("<option selected value=\"base\">Please select one</option>");
$.each(vals, function (index, value) {
$level2.append("<option value=\"" + value.me + "\">" + value.TITLE + "</option>");
});
};
switch (key) {
case 'first_option':
$.getJSON("recursos/json/ajsonfile.json", function (data) {
$level2.empty();
vals = data.first_option.children;
generateDropdown(vals)
$("#first-table").removeClass("d-none");
$("#first-table").addClass("d-block");
info = data.first_option;
$(".first-title").innerHTML(info.TITLE);
generateTable(info);
});
break
case 'second_option':
$.getJSON("recursos/json/anotherjsonfile.json", function (data) {
$level2.empty();
vals = data.second_option.children;
generateDropdown(vals)
$("#first-table").removeClass("d-none");
$("#first-table").addClass("d-block");
info = data.second_option;
$(".first-title").innerHTML(info.TITLE);
generateTable(info);
});
break
case 'base':
$level2.empty();
vals = ['Please select one'];
$level2.append("<option>" + vals + "</option>");
$("#first-table").removeClass("d-block");
$("#first-table").addClass("d-none");
console.log(vals);
break
}
});
//second dropdown
$("#level2").change(function () {
var $dropdown = $(this);
var key = $dropdown.val();
function generateDropdown(vals) {
$level3.append("<option selected value=\"base\">Please select one</option>");
$.each(vals, function (index, value) {
$level3.append("<option value=\"" + value.yo + "\">" + value.TITLE + "</option>");
});
};
switch (key) {
case 'first-child':
$.getJSON("recursos/json/ajsonfile.json", function (data) {
$level3.empty();
vals = data.first_option.children.child01.children;
generateDropdown(vals)
$("#second-table").removeClass("d-none");
$("#second-table").addClass("d-block");
info = data.first_option.children.child01;
$(".second-title").innerHTML(info.TITLE);
generateTable2(info);
});
break
//second, third, fourth child options etc.
case 'base':
$level3.empty();
vals = ['Please select one'];
$level3.append("<option>" + vals + "</option>");
$("#cedula2").removeClass("d-block");
$("#cedula2").addClass("d-none");
console.log(vals);
break
}
});
//third dropdown
$("#level3").change(function () {
// I think you get the gist
});
Is it possible to do some iteration so I can fill all the dropdowns in just one loop?

show only related item in the second select form using javascript

I'm writing a small php page with 2 form:
<div class="input-field col s12">
<select id="select1">
<option value="" disabled selected>Choose your option</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
<select id="select2">
<option value="" disabled selected>Choose your option</option>
<option rel="1" value="11">Option 11</option>
<option rel="1" value="12">Option 12</option>
<option rel="2" value="21">Option 21</option>
<option rel="2" value="22">Option 22</option>
<option rel="3" value="31">Option 31</option>
<option rel="3" value="32">Option 32</option>
</select>
</div>
After I select the first select form, I want that only the related values are showed in the second.
My js is:
$(function() {
$("#select1").on('change', function() {
$subcat = $("#select2");
var _rel = $(this).val();
$subcat.find("[rel="+_rel+"]").show();
$subcat.prop("disabled",false);
// re-initialize material-select
$('#select2').material_select();
});
});
I also try with
var selectobject=document.getElementById("select2")
for (var i=0; i<selectobject.length; i++)
{
if (selectobject.options[i].value == 'xxxx' )
{
selectobject.remove(i);
}
}
But I need the name option, not the value.
$(function(){
$('#select1').on('change', function(){
var val = $(this).val();
var sub = $('#select2');
$('option', sub).filter(function(){
if ($(this).attr('rel') === val) {
if ($(this).parent('span').length) {
$(this).unwrap();
}
} else {
if (!$(this).parent('span').length) {
$(this).wrap( "<span>" ).parent().hide();
}
}
});
});
});
I don't see which options at the second form corresponding to the first, however, try populating the second select rather than removing items from it. like:
<select id="select1" onchange="myfunction(this.value)">
<script>
function myfunction(opt){
var $Select2 = $('#select2');
var option1 = [
{
"name": "option description",
"value": "1"
}, {
"name": "option description",
"value": "1"
}]
var option2 = [
{
"name": "option description",
"value": "1"
}, {
"name": "option description",
"value": "1"
}]
if(opt === option1){
$.each(option1, function (i, item) {
$('#mySelect').append($('<option>', {
value: item.value,
text : item.name
}));
});
}
if(opt === option2){
$.each(option2, function (i, item) {
$('#mySelect').append($('<option>', {
value: item.value,
text : item.name
}));
});
}
}
</script>

Unable to set selected value in select box

// inside controller
$scope.newEngagement.subType = 3;
$scope.engagementSubTypeList = [
{ "subTypeId": 1, "subTypeName": "value1" },
{ "subTypeId": 2, "subTypeName": "value2" },
{ "subTypeId": 3, "subTypeName": "value3" },
{ "subTypeId": 4, "subTypeName": "value4" },
];
<div class="col s12 m12 margin-top-2x" ng-show="isSubType">
<label class="uppercase blue-grey-text text-darken-5 font-1-5x clear left">SELECT SUB TYPE </label>
<select
name="engagement_subtype"
id="engagement_subtype"
ng-model="newEngagement.subType"
class="browser-default margin-top-x col s12 m8 clear">
<option value="{{subTypeList.subTypeId}}"
selected="subTypeList.subTypeId == newEngagement.subType"
ng-repeat="subTypeList in engagementSubTypeList track by subTypeList.subTypeId ">
{{subTypeList.subTypeName}}
</option>
</select>
</div>
According to that above code "value3" should be selected but not happen same as I am using materialize select box browser default class.
Can try this one using ng-options and assign newEngagement.subType from your $scope.engagementSubTypeList like bellow. that should work.
<div class="">
<label class="uppercase">SELECT SUB TYPE </label>
<select ng-options="subTypeList.subTypeId as subTypeList.subTypeName for subTypeList in engagementSubTypeList" ng-model="newEngagement.subType">
<option value="">Select One</option>
</select>
</div>
and controller
$scope.engagementSubTypeList = [
{ "subTypeId": 1, "subTypeName": "value1" },
{ "subTypeId": 2, "subTypeName": "value2" },
{ "subTypeId": 3, "subTypeName": "value3" },
{ "subTypeId": 4, "subTypeName": "value4" },
];
$scope.newEngagement = {};
$scope.newEngagement.subType = $scope.engagementSubTypeList[2].subTypeId;
You can use the following code.
<div class="col s12 m12 margin-top-2x">
<label class="uppercase blue-grey-text text-darken-5 font-1-5x clear left">SELECT SUB TYPE </label>
<select
name="engagement_subtype"
id="engagement_subtype"
ng-model="newEngagement.subType"
class="browser-default margin-top-x col s12 m8 clear">
<option value="{{subTypeList.subTypeId}}"
ng-selected="{{newEngagement.subType == subTypeList.subTypeId}}"
ng-repeat="subTypeList in engagementSubTypeList track by subTypeList.subTypeId ">
{{subTypeList.subTypeName}}
</option>
</select>
</div>
$scope.newEngagement = {};
$scope.newEngagement.subType = 2;//{"subTypeId":3};
$scope.engagementSubTypeList = [
{ "subTypeId": 1, "subTypeName": "value1" },
{ "subTypeId": 2, "subTypeName": "value2" },
{ "subTypeId": 3, "subTypeName": "value3" },
{ "subTypeId": 4, "subTypeName": "value4" },
];
Demo
My suggestion is to avoid the ng-repeat in selection option. You will be use to ng-option, It is only a correct approch in angularjs.

Categories

Resources