【发布时间】:2014-08-14 22:25:18
【问题描述】:
我正在制作一个选择字段。我谷歌它发现我们在选择框中显示不同的字符串并获得不同的值。
http://plnkr.co/edit/I9s79qGwqw0x6hGis0JX?p=preview
现在我正在使用 json 从这里形成插件
https://github.com/nimbly/angular-formly
当我应用所有东西时,它会给出价值 **1,2...** 就像显示名称不同一样。我只是想改变选择框的值我怎么能做到这一点? 这是我的笨蛋
http://plnkr.co/edit/Wcvh2AMxtopPmIwpJkfi?p=preview
$scope.formFields = [
{
//the key to be used in the result values {... "username": "johndoe" ... }
key: 'username',
//default value
default: 'uberuser',
type: 'text',
label: 'Username',
placeholder: 'johndoe',
required: true,
disabled: false, //default: false
description: 'Descriptive text'
}, {
"key": "transportation",
"type": "select",
"label": "How do you get around in the city",
"options": [
{
"name": "Car"
},
{
"name": "Helicopter"
}
]
}
];
我需要如果我选择汽车,它会给出值“aadsasd”。当我选择“直升机”时,会给出值“psasdpasdpasd”
【问题讨论】:
标签: javascript jquery angularjs angularjs-directive