0

I want to have the opportunity to select from a dropdown list a value and to click on a link to get the next Value of the dropdown list. How could I update the selected Value from the dropdown list if I click on the link?

<select class="dropdown-select" name="mySelect" id="chapter" ng-options="option.Icnumber for option in selected" 
ng-model="selected.Icnumber" ng-change="updateChapter(selected.Icnumber.Icnumber)">
</select>

<a ng-show="nextChapter" class="ng-hide" ng-click="updateChapterNext(selected.Icnumber.Icnumber)">Next Chapter</a>

Thanks!

1 Answer 1

2

Angular has a feature called two ways binding, what ever you have in $scope and use it in the template, when you update the value in the controller, it will automatically update the value in the template.

for your problem you use selected as the dropdown value.

so in your updateChapterNext function modify the value for selected

so

$scope.updateChapterNext = function(param){
  // do your thing to call next chapter
  // and assign the response or new value to selected
  $scope.selected = newValueForSelected;
}

this will update the selected value on the dropdown

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.