AngularJS的Firebug中关于ng选项的奇怪错误
当我使用Angular的ng选项时,我得到了一个奇怪的错误:AngularJS的Firebug中关于ng选项的奇怪错误,angularjs,firebug,Angularjs,Firebug,当我使用Angular的ng选项时,我得到了一个奇怪的错误: Error: [ngOptions:iexp] Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got 'playlist.id as playlist.name in playlists | orderBy: 'playlist''. Element: <select class="
Error: [ngOptions:iexp] Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got 'playlist.id as playlist.name in playlists | orderBy: 'playlist''. Element: <select class="ng-pristine ng-valid" name="playlist" ng-model="playlist" ng-options="playlist.id as playlist.name in playlists | orderBy: 'playlist'">
正确的语法是播放列表中播放列表的
playlist.id as playlist.name…
<select name="playlist" ng-model="playlist" ng-options="playlist.id as playlist.name in playlists | orderBy: 'playlist'"></select>
<button class="btn btn-branded" ng-click="postSongToPlaylist(playlist.id);">Save</button>
MediaService.getPlaylists().then(function (response) {
$scope.playlists = response.data.data;
});
$scope.postSongToPlaylist = function(playlist_id) {
media = {
id: $rootScope.song_id
};
MediaService.postSongToPlaylist(playlist_id, media).then(function (response) {});
}