Use JQuery in Angular7

Of course using Jquery in Angular2+ is not good practice, but in really urgent case is not bad to know how to use jquery in  angular7 components. npm i @types/jquery –save open tsconfig.app.json and add jquery in types ex.  “types”: [“jquery”] In some cases, if you need to touch the bootstrap, so needs to run this […]

Custom validation – Reactive Form (using class) in Angular

I already show you how can create custom validation using functions, now we can learn how to made a validation using classes. reactive-form.html <form [formGroup]="registerForm" (ngSubmit)="onSubmit()"> <input type="text" formControlName="email" [ngClass]="{ 'is-invalid': submitted && f.email.errors }" /> <div *ngIf="submitted && f.email.errors"> <div *ngIf="f.email.errors.required">Email is required</div> <div *ngIf="f.email.errors.email">Email must be a valid email address</div> <div *ngIf="submitted && […]

Share data between components – Angular7

In Angular2+, share data between components is very important. Components could have parent/child relation or two components in the same level. Here I tried to give you the code simple and useful, so three different types is mentioned here, but don’t forget that these are all ways to share the variable between components. Parent ⇒ […]