Rehmaanali

Rehmaanali

Founder Of Geekstrick. Full-Time Software Developer, Expertise in Frontend Development. Conversant with - Angular, React, NodeJS, and MongoDB, MySQL, Postgres,HTML+CSS+JS, CypressIO.

What Is A Currying Function In Javascript?

geekstrick on October 18, 2020 πŸ”₯ 154114 views

In this tutorial, we will see What Is A Currying Function In Javascript. Currying is an alteration of functions that turns a function from callable as f(a, b, c) into callable as f(a)(b)(c). Currying Function In Javascript A currying function is a function that takes multiple arguments and turns it into a sequence of functions […]

post

Answer for How to set the headers for every request in Angular?

geekstrick on October 17, 2020 πŸ”₯ 0 views

Add AuthInterceptor that will intercept all your HTTP requests and add the token to its headers: import { Injectable } from ‘@angular/core’; import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from ‘@angular/common/http’; import { Observable } from ‘rxjs’; @Injectable() export class AuthInterceptor implements HttpInterceptor { intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { const token = localStorage.token; // […]

discussion

Answer for What is multicasting in angular and how to achieve multicasting?

geekstrick on October 17, 2020 πŸ”₯ 0 views

Multi-casting is the practice of broadcasting to a list of multiple subscribers in a single execution. Let’s demonstrate the multi-casting feature, var source = Rx.Observable.from([1, 2, 3]); var subject = new Rx.Subject(); var multicasted = source.multicast(subject); // These are, under the hood, `subject.subscribe({…})`: multicasted.subscribe({ next: (v) => console.log(‘observerA: ‘ + v) }); multicasted.subscribe({ next: (v) […]

discussion

Answer for How can I select an element in a component template?

geekstrick on October 17, 2020 πŸ”₯ 0 views

You can handle the DOM element via ElementRef by injecting it into your component’s constructor:   constructor(myElement: ElementRef) { … }

discussion

Ineffective mark-compacts near heap limit Allocation failed – JavaScript heap out of memory

geekstrick on October 14, 2020 πŸ”₯ 0 views

Ineffective mark-compacts near heap limit Allocation failed – JavaScript heap out of memory I am getting this below error although I have a total of 4000 Unit Test Cases (test suits) and my test command is ng test –codeCoverage=true –progress=true –source-map=true   ERROR <— Last few GCs —> [17161:0x3436ed0] 77543 ms: Mark-sweep 1339.8 (1441.9) -> […]

discussion

New Release Announcement of NPM CLI v7.0.0

geekstrick on October 13, 2020 πŸ”₯ 3308 views

Github first introduced the npm v7 last in May. Today, GitHub has announced the release of npm v7.0.0, which will be shipping with Node.js 15.0.0 next week. NPM CLI v7.0.0 you can install it today by running npm i -g npm@7 in your terminal. Features in New NPM CLI npm 7 comes with some long-awaited […]

news

Answer for How to use Wildcard route in Angular?

geekstrick on October 5, 2020 πŸ”₯ 0 views

If the URL doesn’t match any predefined routes then it causes the router to throw an error and crash the app. In this case, you can use a wildcard route. A wildcard route has a path consisting of two asterisks to match every URL. For example, you can define PageNotFoundComponent for wildcard route as below: […]

discussion

routerLinkActive always set home page link as active even if other page is active – Angular 10

geekstrick on October 2, 2020 πŸ”₯ 0 views

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>

discussion

Answer for Difference between an Annotation and a Decorator in Angular?

geekstrick on October 1, 2020 πŸ”₯ 0 views

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.

discussion

Answer for What is ViewEncapsulation and how to do it in Angular?

geekstrick on October 1, 2020 πŸ”₯ 0 views

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 […]

discussion