To do exactly as you’re describing, you would probably have to make the validator a lambda that captures pwd1, something like this:
let validator = () => {
this.form.controls['pwd1'] should be accessible here
};
this.form.controls['pwd2'].validator = validator;
However, that’s sort of ugly. If all you really need is to have the error be applied to pwd2 instead of a larger unit, you can still use the ControlGroup
validator strategy in my first post, and just apply the error directly to the pwd2 control.
pwd2.setErrors({'passwordMismatch':true});
I find that cleaner.