How to show required fields error on reactive form submit in angular 2/4/6?

Angular provides couple of ways to bind validation to form elements. One way is using ngModel directives and it’s applicable for template driven forms. Next way is using FormControl or FormGroup directives and its applicable for reactive forms. We are going to learn here how to show validation error message for the required fields in reactive form when user hit submit button without touching any fields in the form. Reactive form validation examples available in the internet Read more…

How to add directive dynamically in angular 2/4/6?

Many of angular developers who has experience in angularJs would be familar of adding directives dynamically using $compile service. If you are expecting the same feature in angular framework, then simple answer is NO Angular doesn’t expose $compile service to recompile your template and when you add attribute to DOM elements, angular wouldn’t recognize even though attribute is part of angular directive. There are few workaround to add directive dynamically, Let me walk through those Read more…