我希望获得各种操作系统的下拉,供用户选择。到目前为止,这是我的代码
<form id="main">
<table>
<tr>
<td class="display_bold"><label for="name">VM Name:</label></td>
</tr>
<tr>
<td class="display"><input type="text" ng-model="virMachine.vmName" size="40"></td>
</tr>
<tr>
<td class="display_bold" ><label for="name">OS Type:</label></td>
</tr>
<tr>
<td class="display"><input type="text" ng-model="virMachine.osVersion" size="40"></td>
</tr>
</table>
这是我想要创建一个下拉菜单的操作系统列表。
$scope.operatingsystems = ["Ubuntu-16", "Centos 7", "Wimdows"];
我该怎么办?我知道我可能已经将输入类型从文本更改为其他内容但不确定是什么。
答案 0 :(得分:1)
你能做到这一点,
XmlDocument doc = new XmlDocument();
XmlNode docnode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
doc.AppendChild(docnode);
doc.AppendChild(doc.CreateProcessingInstruction("xml-stylesheet", "type='text/xsl' href=''"));
XmlElement Ver = doc.CreateElement("Run");
Ver.SetAttribute("version", "3.0");
XmlElement elem = doc.CreateElement("List");
elem.SetAttribute("Name", ObjectName_string);
XmlElement cmList = doc.CreateElement("cmList");
List<string> data = Event_table.Rows.OfType<DataRow>().Select(dr => dr.Field<string>(0)).ToList();
StringBuilder builder = new StringBuilder();
foreach (var row in data)
{
builder.AppendLine(row);
}
cmList.Value = builder.ToString();
elem.AppendChild(cmList);
Ver.AppendChild(elem);
doc.AppendChild(Ver);
doc.Save(@"1.xml");
// do something with file 1.xml
<强>样本强>
hibernate.transaction.jta.platform_resolver
&#13;
<select ng-model="osType">
<option ng-repeat="os in operatingsystems">{{os }}</option>
</select>
&#13;
答案 1 :(得分:0)
Angular.js中的下拉列表可能如下所示:
<select ng-model="osType">
<option value=" ">Choose OS</option>
<option ng-repeat="o in operatingsystems">{{o}}</option>
</select>