我有一系列对象,描述座位 每个座位对象如下所示:
ID: 1
platz: 1
status: 1
title: "Sitzplatz #1"
userID: 1
现在我使用带有ng-options的AngularJS迭代我的对象数组,如下所示:
<select ng-options="s.status for s in seating"></select>
但是我收到了一个错误:
Error: [$compile:ctreq] http://errors.angularjs.org/1.5.0/$compile/ctreq?p0=ngModel&p1=ngOptions
at Error (native)
at http://localhost/netconnect-4.0/assets/scripts/vendor/angular.min.js:6:416
at s (http://localhost/netconnect-4.0/assets/scripts/vendor/angular.min.js:63:198)
at s (http://localhost/netconnect-4.0/assets/scripts/vendor/angular.min.js:63:265)
at u (http://localhost/netconnect-4.0/assets/scripts/vendor/angular.min.js:66:175)
at g (http://localhost/netconnect-4.0/assets/scripts/vendor/angular.min.js:58:136)
at g (http://localhost/netconnect-4.0/assets/scripts/vendor/angular.min.js:58:153)
at g (http://localhost/netconnect-4.0/assets/scripts/vendor/angular.min.js:58:153)
at g (http://localhost/netconnect-4.0/assets/scripts/vendor/angular.min.js:58:153)
at g (http://localhost/netconnect-4.0/assets/scripts/vendor/angular.min.js:58:153) <div ng-include="'app/shared/modals/adminEditorSeating.html'" class="ng-scope">
答案 0 :(得分:3)
无论何时使用ng-options,都需要使用ng-model。
答案 1 :(得分:0)
试试这个
<select ng-model="modelname" ng-options="s.status for s in seating"></select>