angularjs 绑定多个属性到下拉框
2021-05-17 10:27
标签:options blog data 活动 code success console nbsp 下拉 绑定下拉框 angularjs 代码: 普通绑定下拉框 html 代码写法: 普通取值下拉框值写法: 绑定多个属性到下拉框 html 代码写法: 多个属性取值: angularjs 绑定多个属性到下拉框 标签:options blog data 活动 code success console nbsp 下拉 原文地址:http://www.cnblogs.com/yangjinwang/p/7745068.html //活动下拉切换
$scope.activityChange = function () {
var cards = new Array();
var url = "/CustomCard/GetCustomCardListByAct";
$.ajax({
url: url,
type: ‘Get‘,
async: false,
data: { actName: $scope.formData.SelectActivityType },
success: function (data) {
if (data != null) {
$.each(data, function (i, n) {
//, cu.IsBindDealerId,cu.IsBindVIN, cu.WriteOffNumber
var cardinfo = { activity: n.ActivityType, cardid: n.CardType, cardtitle: n.CardTypeName, code: n.code, IsBindDealerId: n.IsBindDealerId, IsBindVIN: n.IsBindVIN, WriteOffNumber: n.WriteOffNumber }
cards.push(cardinfo);
});
$scope.cardTypes = cards;
}
},
error: function (err) {
alert("error...");
}
});
}
div class="form-group">
label class="col-md-2 control-label">卡劵类型:label>
select ng-change="activityChangetype()" id="ii" class="col-md-2 form-control" ng-model="formData.SelectCardType" ng-options="m.cardid as m.cardtitle for m in cardTypes" >
option value="">请选择option>
select>
div>
//卡券类型下拉切换
$scope.activityChangetype = function () {
console.log("选择了卡券类型");
//取到下拉框的Value
console.log($scope.formData.SelectCardType);
}
div class="form-group">
label class="col-md-2 control-label">卡劵类型:label>
select ng-change="activityChangetype()" id="ii" class="col-md-2 form-control" ng-model="formData.SelectCardType" ng-options="y.cardtitle for (x, y) in cardTypes">
option value="">请选择option>
select>
div>
//卡券类型下拉切换
$scope.activityChangetype = function () {
console.log("选择了卡券类型");
console.log($scope.formData.SelectCardType.cardid);
console.log($scope.formData.SelectCardType.IsBindDealerId);
console.log($scope.formData.SelectCardType.IsBindVIN);
console.log($scope.formData.SelectCardType.WriteOffNumber);
if ($scope.formData.SelectCardType.WriteOffNumber>1)
{
console.log("选择的卡券可核销次数大于1");
// $scope.formData.MovingCode.
}
}
文章标题:angularjs 绑定多个属性到下拉框
文章链接:http://soscw.com/index.php/essay/86670.html