Is there a way to dynamically update the ServiceName dropdown options based on the selected value in the ServiceType dropdown?
$scope.ServiceTypeAndName = [
{
"id":0,
"type":"",
"list":""
},
{
"id":1,
"type":"In-Person",
"list":["ADL Functional Assessment", "Community Functional Assessment", "Future Care Cost Analysis"]
},
{
"id":2,
"type":"Paper Review",
"list":["OT - In Home Assessment - ABI", "OT - In Home Assessment Attendant Care with Form 1", "OT - Occupational Therapy Assessment"]
},
{
"id":3,
"type":"Administration",
"list":["Situational Assessment", "Situational Assessment (OT) - Day 1", "Situational Assessment (OT) - Day 2", "Construction Cost Consulting"]
}
];
$scope.selectedLine = [{"Event_ID": "100", "Service_Type": "In-Person", "Service_Name": "Community Functional Assessment"}, {"Event_ID": "101", "Service_Type": "Paper Review", "Service_Name": "OT - Occupational Therapy Assessment"},{"Event_ID": "102", "Service_Type": "In-Person", "Service_Name": "Future Care Cost Analysis"}];
<select ng-model="selectedLine.Service_Type" name="ServiceType" class="form-control">
<option ng-repeat="temp in ServiceTypeAndName" value="{{temp.type}}">{{temp.type}}</option>
</select>
<select ng-model="selectedLine.Service_Name" name="ServiceName" ng-required="selectedLine.Service_Type!=''" class="form-control">
</select>
For instance, if the first object is loaded, the "In-Person" option should be pre-selected in the first dropdown and the "Community Functional Assessment" value should be pre-selected in the second dropdown. Any changes in the first dropdown should update the options in the second dropdown accordingly.