/// <summary> /// 更改为横向样式 /// </summary> /// <typeparam name="TModel"></typeparam> /// <typeparam name="TProp"></typeparam> /// <param name="angularFormGroup"></param> /// <returns></returns> public static AngularFormGroup <TModel, TProp> Horizontal <TModel, TProp>(this AngularFormGroup <TModel, TProp> angularFormGroup) { //<form class="form-horizontal w5c-form demo-form" role="form" w5c-form-validate="vm.validateOptions" novalidate name="validateForm"> // <div class="form-group has-feedback"> // <label class="col-sm-3 control-label" for="vm_entity_email">邮箱</label> // <div class="col-sm-9"> // <input type="email" name="email" id="vm_entity_email" ng-model="vm.entity.email" required="" class="form-control" placeholder="输入邮箱"> // </div> //</form> angularFormGroup.Label = angularFormGroup.Label.AddClass("col-sm-3"); var wrap = new HtmlTag("div"); wrap = wrap.AddClass("col-sm-9"); angularFormGroup.Input.WrapWith(wrap); //angularFormGroup.Input = angularFormGroup.Input.WrapWith(wrap); //angularFormGroup.FormGroup.ReplaceChildren(angularFormGroup.Label, angularFormGroup.Input); return(angularFormGroup); }
/// <summary> /// /// </summary> /// <param name="angularFormGroup"></param> public static AngularFormGroup <TModel, TProp> Email <TModel, TProp>(this AngularFormGroup <TModel, TProp> angularFormGroup) { return(WithAttr(angularFormGroup, "type", "email")); }
/// <summary> /// /// </summary> /// <param name="angularFormGroup"></param> public static AngularFormGroup <TModel, TProp> Required <TModel, TProp>(this AngularFormGroup <TModel, TProp> angularFormGroup) { return(WithAttr(angularFormGroup, "required", "")); }
/// <summary> /// 自定义属性 /// </summary> /// <param name="angularFormGroup"></param> /// <param name="attribute"></param> /// <param name="value"></param> public static AngularFormGroup <TModel, TProp> WithAttr <TModel, TProp>(this AngularFormGroup <TModel, TProp> angularFormGroup, string attribute, object value) { angularFormGroup.Input.Attr(attribute, value); return(angularFormGroup); }