我想将选定的颜色值从dd框保存到$ scope.color中。如何在AngularJS中保存选定的选项(下拉框)
的Index.html:
<label class="item item-select" name="selectName">
<span class="input-label">What is your favourite colour?</span>
<select id="colorid">
<option ng-repeat="x in colorList"{{x}}</option>
</select>
</label>
controller.js:
var colorCtrl = function($scope){
$scope.color = "";
$scope.colorList =["red","blue","yellow"];
console.info("color is "+$scope.color);
}
尝试请说明您详细 –
需要我想在控制台上显示选择的颜色名称。 –