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 the difference between async and defer in JavaScript? While we import the javascript file using script tag we use async or defer or just normal script tags what is the difference. // Normal Include <script src=”demo.js”></script> // Defer Include <script src=”demo.js” defer></script> // Async Include <script src=”demo.js” async></script>
For Merging two different object you can do this /** * Merge Two objects and return combined object */ merge = (target, source) => { // Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties for (const key of Object.keys(source)) { if (source[key] instanceof Object) { if […]
In this tutorial, we will see what are the different ways to Pass Data From Routes To Components In Angular 10. In other words like sending data from anchor tags or routing module files of angular other than query params. Pass Data From Routes (Static Data) For passing the static data (via the routing module) […]
Yes, it is possible to write unit test cases for the private function of the component. for your method, it will be tested as beforeEach(() => { fixture = TestBed.createComponent(AuthContainerComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it(‘should go to error field’, () => { // arrange … // act (component as any).scrollToFirstInvalidControl(); //assert …. });
You can add configuration for scroll to top when ever route is change using property scrollPositionRestoration: ‘enabled’ @NgModule({ imports: [RouterModule.forRoot(routes, { scrollPositionRestoration: ‘enabled’ } )], exports: [RouterModule] })
npm cache clean –force npm i -g @angular/cli has fixed the issue for me.
setTimeout setTimeout allows us to run a function once after the interval of time. In short, the method will be invoked only once after a defined delay time. setInterval setInterval allows us to run a function repeatedly, starting after the interval of time, then repeating continuously at that interval. In short, the method will […]
Microsoft has announced that New Features in TypeScript 4.1 beta version also new checking flags and speed improvements. Release Date : 18 September, 2020 Release Notes : https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript Command to Install: npm install typescript@beta New Feature In TypeScript Template Literal Types Key Remapping in Mapped Types Recursive Conditional Types –noUncheckedIndexedAccess paths without baseUrl checkJs Implies […]
In this lesson, we will see how can we build our angular library and also will look into how can we publish the angular library to local npm and use it. Build Angular Library We can use the library in locally importing through the project folder but at the user end actual implementation is that […]