There are several questions like this one, but none of those worked for me. Simply stated, using ng-options, I am getting data from a MYSQL db and I want to put the value from the DB as the selected value of a select element. The select element populates with the list of data just fine
JS
$scope.cwsi = $scope.cws[3];
HTML - This does not work
<select ng-options="cw as cw.initials for cw in cws" ng-model="cwsi"></select>
HTML - This does work
<select ng-options="cw as cw.initials for cw in cws" ng-model="cws[3]"></select>
$scope.cws is an array of objects that contains an id, initials, and a name
What am I doing wrong here? Thank you
I was using a dialog box in a different scope.
As the infamous Homer Simpson once said "D'oh!"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.