0
  • I have one dropdown lets say Drop-down A, based on option selected from that, new dropdowns will be populated. For example,on selection of option 1 from Drop-down A, 2 new dropdowns will be showed. similarly on selection of other options new dropdowns will be populated and other dropdowns will be removed.
  • Now when I select options from newly populated dropdowns,I can get their value.
  • Problem comes when I select option 1 from Drop-down A and then select values from newly generated dropdowns, but now I wish to change Drop-down A slection to option 2. Now based on current selection, new dropdowns will be generated. So if now I post the values, my controller still shows, previous option 1 values.

    So how can I change unselected dropdown values to null?

    See Plunker

1 Answer 1

1

If I understand you problem right, I would prefer to create a function in controller to reset object.

$scope.onChange = function(){
   $scope.obj = {};
}

And call it on ng-change

<select ng-model="selectC" ng-change="onChange()"  name="subSub" id="main">

Wokring plunker

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.