I am working on a login form and if the user enters invalid credentials we want to mark both the email and password fields as invalid and display a message that says the log
Though its late but following solution worked form me.
let control = this.registerForm.controls['controlName'];
control.setErrors({backend: {someProp: "Invalid Data"}});
let message = control.errors['backend'].someProp;