I believe you need to use [routerLinkActiveOptions] in your template page. [routerLinkActiveOptions]=”{exact:true}” Set the above [routerLinkActiveOptions] directive to all navigation links, which will add the routerLinkActive class to only those navigation links which match the entire URL.
I am using the angular 10 version I have an issue withΒ the routerLinkActive it is setting the home URL (base URL) to active even if the route is on another page. <li class=”nav-item”> <a class=”nav-link” [routerLink]='[“”]’ routerLinkActive=’active’>Home</a> </li> <li class=”nav-item”> <a class=”nav-link” [routerLink]='[“/contact-us”]’ routerLinkActive=’active’>Contact Us</a> </li>
Annotations In Angular, annotations are used for creating an annotation array. They are only metadata sets of the class using the Reflect Metadata library. Decorators In Angular Decorators are design patterns used for separating decoration or modification of some class without changing the source code.
ViewEncapsulation determines whether the styles defined in a particular component will affect the entire application or not. Angular supports 3 types of ViewEncapsulation: 1) Emulated β Styles used in other HTML spread to the component 2) Native β Styles used in other HTML doesnβt spread to the component 3) None β Styles defined in a […]
To call multiple API parallelly and get a combined response in one short we can use forkJoin method of rxjs. You can do something like this as shown below, forkJoin([ getCurrentUser(), //observable 1 getDeviceConditions() //observable 2 ]).subscribe(([users, deviceConditions]) => { // When Both are done loading do something });
I have multiple methods that contain individual get method but in component How to Call Multiple Rest API and Subscribe in component i.e. calling multiple methods in one subscribe. /** * Get current User from the server. * * @returns {json} current user. */ public getCurrentUser(): any { return this.http.get(this.baseUrl) .pipe(map((res: any) => res.data)); } […]
(a, b) => a + b; is pure a => a + 2; is pure a => b => a + b; is pure a => a + b; is impure as it uses an external value (b) (a, b) => c = a + b; is also impure as it has a side effect […]
Can anyone explain how to use ViewEncapsulation in angular with example?
Can anyone please explain the difference between an Annotation and a Decorator in Angular with example?
Pure Pipe A pure pipe is only called when Angular detects a change in the value or the parameters passed to a pipe @Pipe({ name: ‘filterPipe’, pure: true })export class FilterPipe {} Impure Pipe An impure pipe is called for every change detection cycle no matter whether the value or parameter(s) changes. An impure pipe […]