We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a model, with a description field, which is some time is required.
model.js
description: validator('presence', { presence: true, disabled(model) { return this.get('model.simple') } }),
In my {{form-group}} component the label has a class, if the field is required. (It depends on if the model has a validation on the property)
components/form-group.js
init() { this._super(...arguments); var valuePath = this.get('property'); defineProperty(this, 'required', computed.oneWay(`model.validations.attrs.${valuePath}`)); }, hasValidationClass: computed('required', function(){ return this.get('required') ? 'has-error' : ''; }),
components/form-group.hbs
{{#if label}} <label class="{{labelClass}} {{hasValidationClass}} control-label"> {{label}} </label> {{/if}}
Is there a way to find out if the validator is disabled or not, so I could do something like this?
hasValidationClass: computed('required', function(){ return this.get('required') && !this.get('required.disabled') ? 'has-error' : ''; }),
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have a model, with a description field, which is some time is required.
model.js
In my {{form-group}} component the label has a class, if the field is required. (It depends on if the model has a validation on the property)
components/form-group.js
components/form-group.hbs
Is there a way to find out if the validator is disabled or not, so I could do something like this?
components/form-group.js
The text was updated successfully, but these errors were encountered: