AngularJs dependant picklist

79 views Asked by At

I am working on dependant picklist in angularJS and facing issue. Please check code below.

<form class="mf-form-wrapper" method="POST">
    <select class="mf-option-type" ng-model="categ" ng-options="type for (type,categ) in mfcategory">
        <option value="">Scheme Type</option>
    </select>
    <select class="mf-option-category" ng-disabled="!selectedType" ng-model="selectCategory" ng-options="x for x in categ">
        <option value="">Fund category</option>
    </select>
    <select class="mf-option-amc" ng-model="selectAMC" ng-options="y.name for y in familyunit">
        <option value="">Select AMC</option>
    </select>
    <button class="mf-search-btn" type="button" name="search" ng-click="mfSearchResult(categ,selectCategory,selectAMC.id)">Search</button>
</form>

And in controller data is

 $scope.mfcategory = {
    'Open Ended':['Income', 'Balanced', 'Liquid', 'Growth', 'ELSS', 'Money Market', 'Fund of Funds - Domestic', 'Fund of Funds - Overseas', 'Gold ETFs', 'Gilt', 'Other ETFs'],
    'Closed Ended':['Income','Growth']
};
$scope.familyunit = [{ "id": 53, "name": "ABC" }, { "id": 4, "name": "DEF" }];

Now the problem is on button click I need to send the selected picklist values to controller.I want all 3 selected picklist values and first 2 picklist are dependant. so mfSearchResult(categ,selectCategory,selectAMC.id) is causing issue.

Instead of categ='Open Ended' as argument, I am getting whole array of values as

'Income', 'Balanced', 'Liquid', 'Growth', 'ELSS', 'Money Market', 'Fund of Funds - Domestic', 'Fund of Funds - Overseas', 'Gold ETFs', 'Gilt', 'Other ETFs'

I am looking for a way to get selected values to be send as argument. Hope it clears the issue now. There is nothing more in controller for this functionality.

0

There are 0 answers