/// <summary> /// Retrieves the validation metadata for the specified expression and concatenates a validation statement to the current binding. /// </summary> /// <typeparam name="TProperty">The type of the property.</typeparam> /// <param name="expression">An expression that identifies the object that contains the properties to render.</param> public NgClassErrorBinding <TModel> And <TProperty>(Expression <Func <TModel, TProperty> > expression) { var expressionText = ExpressionHelper.GetExpressionText(expression); var nodeName = _form.GetPropertyIdentifier(expressionText); var formNodeName = _form.GetElementFormIdentifier(nodeName); _validations.Add(formNodeName + ".$invalid"); switch (_validationMode) { case ValidationMode.FormSubmitted: _conditions.Add(_form.Name + ".$submitted"); break; case ValidationMode.FormDirty: _conditions.Add(_form.Name + ".$dirty"); break; case ValidationMode.ControlDirty: _conditions.Add(formNodeName + ".$dirty"); break; } return(this); }
/// <summary> /// Retrieves the validation metadata for the specified expression and concatenates a validation statement to the current binding. /// </summary> /// <typeparam name="TProperty">The type of the property.</typeparam> /// <param name="expression">An expression that identifies the object that contains the properties to render.</param> public NgClassErrorBinding <TModel> And <TProperty>(Expression <Func <TModel, TProperty> > expression) { var expressionText = ExpressionHelper.GetExpressionText(expression); var nodeName = _form.GetPropertyIdentifier(expressionText); var formNodeName = _form.GetElementFormIdentifier(nodeName); _validations.Add(formNodeName + ".$invalid"); if (_onDirtyOnly) { _dirty.Add(formNodeName + ".$dirty"); } return(this); }