I have a validator class I want to use in a component, but I don’t want to initialize it until after the template has rendered because it needs to set events on elements within the template based on options passed to the class. How do I do that?
import Validator from '../util/Validator';
export default Component.extend({
tag: 'page-updates',
viewModel: ViewModel,
template,
init() {
let fields = {
"email": ["required"]
};
this.viewModel.validator = new Validator("formId", fields);
}
});