gpt4 book ai didi

javascript - 使用 ng-options 进行错误迭代

转载 作者:太空宇宙 更新时间:2023-11-04 16:06:27 24 4
gpt4 key购买 nike

我有一组描述座位的对象。
每个座位对象看起来像这样:

ID: 1
platz: 1
status: 1
title: "Sitzplatz #1"
userID: 1

现在我使用 AngularJS 和 ng-options 像这样迭代我的对象数组:

<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">

最佳答案

无论何时使用 ng-options,都需要使用 ng-model。

关于javascript - 使用 ng-options 进行错误迭代,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37832480/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com