public HtmlElementBase <BsHtmlElement> CreateInput(InputTagType inputTagType, AutoFocus autoFocus,
                                                           ModelMetadata modelMetadata, string name)
        {
            name = CamelCase(name);
            var input = new BsHtmlElement(HtmlTag.Input)
                        .CssClass(inputTagType != InputTagType.CheckBox, BsClass.Control.FormControl)
                        .Attr(HtmlAttr.Type, GetInputTypeString(modelMetadata, inputTagType))
                        .Attr(HtmlAttr.Id, name)
                        .Attr(HtmlAttr.Name, name)
                        .Attr(NgTag.NgModel, string.Format("model.{0}", name));

            if (modelMetadata.Model != null)
            {
                var modelValue = modelMetadata.Model.ToString();
                input
                .Attr(HtmlAttr.Value, modelValue)
                .Attr(NgTag.NgInit,
                      string.Format("model.{0}={1}", name, JsonConvert.SerializeObject(modelMetadata.Model)));
            }

            // --- Set the appropriate autofocus
            if (autoFocus == AutoFocus.Set ||
                (_formBuilder.HtmlHelper.ViewData.ModelState.IsValid && autoFocus == AutoFocus.OnFormValid) ||
                (!_formBuilder.HtmlHelper.ViewData.ModelState.IsValid && autoFocus == AutoFocus.OnFormInvalid))
            {
                input.Attr(HtmlAttr.AutoFocus);
            }

            // --- Validation attributes for input
            foreach (var attribute in modelMetadata.AdditionalValues.Values.OfType <ValidationAttributeMetadata>())
            {
                foreach (var directive in attribute.DirectiveSet)
                {
                    input.Attr(directive.Key, directive.Value ?? "");
                }
                if (attribute.AdditionalAttributes == null)
                {
                    continue;
                }
                foreach (var key in attribute.AdditionalAttributes.Keys)
                {
                    input.Attr(key, attribute.AdditionalAttributes[key]);
                }
            }
            return(input);
        }
        /// <summary>
        /// Builds a horizontal static text control
        /// </summary>
        /// <param name="modelMetadata">Model metadata</param>
        public MvcHtmlString BuildHorizontalStatic(ModelMetadata modelMetadata)
        {
            // --- The form group that encapsulates the label and the control
            var propName  = CamelCase(modelMetadata.PropertyName);
            var formGroup = new BsFormGroup {
                Depth = _formBuilder.Depth + 1
            };
            var label     = CreateTextLabel(modelMetadata);
            var staticDiv = new BsHtmlElement(HtmlTag.Div);

            staticDiv.ApplyColumnWidths(null,
                                        _formBuilder.BsForm.InputWidthXs,
                                        _formBuilder.BsForm.InputWidthSm,
                                        _formBuilder.BsForm.InputWidthMd,
                                        _formBuilder.BsForm.InputWidthLg);
            var staticText = new BsHtmlElement(HtmlTag.P);

            staticText.CssClass(BsClass.Control.Static);
            staticText.AddChild(new HtmlText(modelMetadata.Model.ToString()));
            staticDiv.AddChild(staticText);
            var hidden = new BsHtmlElement(HtmlTag.Input)
                         .Attr(HtmlAttr.Type, "hidden")
                         .Attr(HtmlAttr.Id, propName)
                         .Attr(HtmlAttr.Name, propName)
                         .Attr(NgTag.NgModel, string.Format("model.{0}", propName));

            if (modelMetadata.Model != null)
            {
                var modelValue = modelMetadata.Model.ToString();
                hidden
                .Attr(HtmlAttr.Value, modelValue)
                .Attr(NgTag.NgInit,
                      string.Format("model.{0}={1}", propName, JsonConvert.SerializeObject(modelMetadata.Model)));
            }
            formGroup.AddChild(label).AddChild(staticDiv).AddChild(hidden);
            return(formGroup.Markup);
        }