关于angularjs的下拉列表的绑定1:数据库的表.  /// <summary>
/// 会员类型(MEMBERTYPE:00:系统⽤户 01:个⼈ 02:教师 03:机构 04:⾳协)
/// </summary>
public string MemeberType { get; set; }
/// <summary>
/// 显⽰名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 登录名
/// </summary>
public string LoginName { get; set; }
/// <summary>
/// 真实姓名
/// </summary>
public string RealName { get; set; }
/// <summary>
/// 密码
/// </summary>
public string Password { get; set; }
/// <summary>
/// 头像
/
// </summary>
public string HeadImage { get; set; }
/// <summary>
/// 出⽣⽇期
/// </summary>
public DateTime? Birthday { get; set; }
/// <summary>
/// 省份
/// </summary>
public string Province { get; set; }
/// <summary>
/
// 城市
/// </summary>
public string City { get; set; }
/// <summary>
/// 区域
/// </summary>
public string Area { get; set; }
/// <summary>
/// 邮编
/// </summary>
public string Zipcode { get; set; }
/
// <summary>
/// 详细地址
/// </summary>
public string Address { get; set; }
/// <summary>
///性别
/// </summary>
public bool Gender { get; set; }
/// <summary>
/// 简介
/// </summary>
public string Introduction { get; set; }
/// <summary>
/// ⼿机号
/// </summary>
public string Mobile { get; set; }
/// <summary>
/// 邮箱
/// </summary>
public string Mail { get; set; }
/// <summary>
/// 会员等级 MEMBERVIP:99:普通会员 01:⼀级会员 02:⼆级会员 03:三级会员 04:四级会员 05:五级会员        /// </summary>
public string Vip { get; set; }
/// <summary>
/// 有效期
/// </summary>
public DateTime? ValidityPeriod { get; set; }
2:控制器中获取会员列表函数
/// <summary>
/// 获取类别为教师的数据("02")
/// </summary>
/// <param name="MemberType"></param>
/// <returns></returns>
public ActionResult GetMemberList(string MemberType)
{
MemberService memberService = new MemberService();
List<Member> memberlist = memberService.GetMemberList(MemberType);
Hashtable rtnVal = new Hashtable();
rtnVal.Add("list", memberlist);
return CreateJsonResult(rtnVal);
}
3:具体的函数
/ // <summary>
/// 获取类别为教师的会员列表
/
// </summary>
/// <param name="MemberType"></param>
/// <returns></returns>
public List<Member> GetMemberList(string MemberType)  //传过来的参数是"02"
{
return base.FindList().FindAll(x => x.MemeberType == MemberType);
}
4:congtroller.js中调⽤改⽅法
//调⽤GetMemberList()⽅法,获取会员类别为教师的编号
$http.post('Course/GetMemberList', { MemberType: "02" })  //传⼊参数“02”
.success(function (response) {
var model = $del = {};
model.Membercode = "22";  //给⼀个初始值  Membercode是会员编号
}, function (x) {
Notify.alert('Server Request Error', $ifyOpts);
});
angular和angularjs
5:html页⾯
<div class="form-group">
<label for="model_MemberCode" class="control-label col-md-2">{{'COURSE.MEMBERCODE' | translate}}</label>                <div class="col-md-10">
<select class="form-control" name="model_MemberCode" required="" ng-model="model.Membercode" ng-options="member.Code as member.RealName for member in mode
<option value="">--⽬的是获取会员类别是教师的编号--</option>
</select>
<span ng-show="validateInput('model_MemberCode', 'required')" class="text-danger">不可为空</span>
</div>
</div>

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。