角度Ng选项错误?(angular Ng-options error?)
我正在尝试使用基于ng-option的下拉菜单。 我的代码目前看起来像这样:
<select ng-options="choice.id as choice.singular in model.quanityChoices" ng-model="med.id" <option value=""></option> </select>基于此的模型数据如下所示:
[ {id: 1, singular: 'word'}, {id: 2, singular: 'word2'} ]目前我的目标是有一个下拉列表,用户将看到选项'word'和'words',但应用的值是ID。
目前我的代码有以下错误:
Error: [ngOptions:iexp] Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got 'choice.id as choice.singular in model.quantityFormChoices'. Element: <select...I am trying to use an ng-option based drop down. My code currently looks like this:
<select ng-options="choice.id as choice.singular in model.quanityChoices" ng-model="med.id" <option value=""></option> </select>The model data this is based off looks like this:
[ {id: 1, singular: 'word'}, {id: 2, singular: 'word2'} ]Currently my goal is to have a dropdown where the user will see the options 'word' and 'words' but the value that gets applied is the ID.
Currently my code has the following error:
Error: [ngOptions:iexp] Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got 'choice.id as choice.singular in model.quantityFormChoices'. Element: <select...最满意答案
您没有正确构造它,查看错误,因为它为您提供了有关如何执行此操作的详细信息:
<select ng-options="choice.id as choice.singular for choice in model.quanityChoices" ng-model="med.id" <option value=""></option> </select>You didn't structure it correctly, look at the error as it gives you the details on how to do it:
<select ng-options="choice.id as choice.singular for choice in model.quanityChoices" ng-model="med.id" <option value=""></option> </select>更多推荐
id,singular,'word',目前,<select,电脑培训,计算机培训,IT培训"/> <me
发布评论