Skip to main content

Posts

Showing posts with the label angularc10

Different between ``===`` and ``==`` operators in JavaScript

Hello Guys, In this blog we are going to learn about "===" and "==" different with details understanding and examples. JavaScript operators that you might have stumbled upon as a developer include "===", "==". JavaScript's "==" operator is commonly utilized for loose comparison purposes.  It functions by converting both of the values to a common type and then comparing them for equality.  Here's an example: The comparison operator "==" transforms the value of "17" from a string to a number before determining if the values match.  Consequently, if both versions of the data share the same properties and values, the comparison is marked as valid and returns true. The results of the "==" operator can occasionally be surprising, including: The comparison returns true when the "==" operator converts the empty string to the number 0 and compares it to the number 0.  This can result in bugs, so

Different between VAR, LET and CONST in JavaScript with examples.

Hello Guys, In this blog we are going to learn about LET, CONT, VAR keywords in JavaScript. To store data in JavaScript, you have three ways of declaring variables: var, const, and let.   These three have the same purpose but vary in certain aspects. Familiarizing yourself with the contrasts can guide you on which to select for your unique requirements. JavaScript's let, const, and var have some notable distinctions to consider. `LET` :-  Here's an example: the let keyword enables block-scoped variables to be declared.  Only the block where it was declared and any nested blocks within it have access to a variable with let due to block scoping. Introduced in ES6, let offers this capability. The concept of variable shadowing is demonstrated by the double declaration of let for x.  Despite sharing a name, one instance occurs in the example function block and the other occurs within the if block.  They can be treated as individual variables due to their separate block declaratio

What is Map() Method? explain with with examples

Hi Guys, In this blog we are going to learn about map() method in JavaScript with detail understanding and examples. Map() :-  The map() method is one of the most critical tools in JavaScript programming. Its objective is to apply a function to every element present in an array, resulting in a new collection of effects. The method is highly valued by developers, and in this piece, we will investigate this method, delve into its mechanics, explore its syntax, and provide practical examples. The new array containing results is generated by calling the map() method on an array with a callback function applied to each element. The callback function can be passed as an argument and is executed during the process. For the map() method, the syntax is established as follows: When using the map() method, the the current element being processed, the array that the method was called on, and the index of the current element are passed as arguments to the callback function. It is also possible to u

What is Resolver in Angular with Examples.

 What is Resolve in Angular? Well, essentially Resolve is a tool that allows developers to load data that’s relevant to a particular component on a specific route. It does this by resolving optional comma-delimited dependencies before it triggers a router change. This ensures that necessary data is available before entering the new route, hence the name Resolve. Essentially, Resolve is a great way to optimize your app’s load times and user experience. Using the Resolve feature in Angular enables the preloading of data before activating a route. It serves as a valuable tool for retrieving data from an external source prior to presenting a component's content. With Resolve, data availability can be established ahead of rendering the component, preventing any empty or flashing content in the page. How does Resolve work? The initial step for utilizing Resolve is to establish a resolver function, which fetches the data from an outside source and relays it back to the component. Integrat

What is Structure Directives in Angular with examples and types

Hello Guys, In this blog we are going to learn about structure directive in angular with detail understanding and examples. What is a Structure Directive in Angular? Angular boasts a distinctive type of directive, known as the structure directive, that is purposed to change a webpage's DOM.  Such directives abound in the ability to add, remove or manipulate elements contingent on certain given conditions. Notably, these directives differ from attribute directives, which are known to primarily affect the behavior and appearance of an element, without manipulating it structurally.  Structure directives are therefore capable of removing, or adding elements to the webpage's DOM. Angular has three directives for built-in structure: *ngIf, *ngFor, and *ngSwitch .  Here, we'll inspect each of them more closely. *ngIf Rendered elements in the DOM only if the *ngIf directive is utilized for conditional purposes.  The directive will analyze an expression and only display the element

What is CanActivateChild() Method in angular routes with details understanding and examples

Hello Guys, In this blog we are going to learn about child routes using auth guard with CanActivateChild() with details understanding and examples. CanActivateChild()  allows you to guard child routes in a similar way to  CanActivate  for guarding individual routes. CanActivateChild() is basically used to protect child routes inside the application from unauthorized users. This means if users don't have access then they can't access child routes. When every you creating canActivateChild, in that we are creating guards that execute before access of child routes. CanActivateChild() method normally takes two parameters : route and state. The route parameter represents the child route being activated, while the state parameter represents the current router state. The CanActivateChild() method must return a boolean value indicating whether the user has permission to access the child method. For Examples :    Authenticating users with a service named authService, our guard, "