Two way binding in select using ng-options

时间:2018-06-04 17:35:14

标签: javascript angularjs

I'm trying to use ng-options in select to iterate over an array.This select is basically used as a question navigator.I want to use two way data binding.Actually I have an array of questions and displaying one question in one page.So the question at the zeroth index should be selected when the page no is 0 and vice versa.I'm getting a blank option in the select and on selecting an other question it does not navigate to the respective page.Here is my code-

 <select ng-model="liveCtrl.currentPage" ng-options="question.question for (index,question) in liveCtrl.questions track by index" ng-selected="index===liveCtrl.currentPage"></select>

0 个答案:

没有答案