0

说我们有这个代码:

for (var i = 0; i < $scope.playList.Videos.length; i++) {
    if ($scope.playList.Videos[i].Id == $scope.video.Id) index = i;
}
$scope.playList.currentVideo = index + 1;
$scope.playList.selectedVideo = $scope.playList.Videos[index];
$scope.playList.totalVideos = $scope.playList.Videos.length;

如您所见,播放列表中有一些视频,并且该列表中有一个视频对象。比它通过找到的索引设置一些值,例如current video indexand 。current video

但是当我执行以下操作时:

<select class="selectVideo" ng-options="vid as playList.Videos.indexOf(vid)+1 for vid in playList.Videos track by video.Id" ng-model="playList.selectedVideo" class="browser-default"></select>

它没有选择我的视频,我通过 ID、索引等尝试了它,但似乎没有一个能满足我的要求。

任何线索为什么?

4

0 回答 0