angularJs 变量会有类型之分

mac2022-06-30  82

<select ng-model="inventory.vegetableId+''" ng-options="vegetable.id as vegetable.name for vegetable in vegetables"> <option value="">--- 蔬菜 ---</option></select>当inventory.vegetableId 产生变化时, select却没有跳到对应的默认值,用法全部正确,但就是显示不去,随即用input text 绑定ng-model="inventory.vegetableId", 数值变化是正确的,之后猜测是不是类型关系,直接 +'' 数值显示正常, 略坑。

转载于:https://www.cnblogs.com/yuanshixingdan/p/8126518.html

最新回复(0)