Skip to main content

Posts

Showing posts from 2023

Learn About Call(), Apply() and Bind() Method in JavaScript

Hello Guys, In this blog your going to learn about CALL(), APPLY() and BIND() method in JavaScript with details understanding and examples. Invoking a function with a specific this value is possible in JavaScript through call(), apply(), and bind(). These three methods may be comparable in terms of their function, but the way they operate and handle arguments set them apart. call(), apply(), and bind() can be confusing to differentiate, so let's look at how each one differs from one another. Call() :-  Method used to invoke a function with specified this value and given arguments - call(). First argument is this value, followed by any expected arguments. For instance, a case in point: Calling findNames() in this scenario, we set the this value to person, thus causing person.name to equate to this.name within the function. APPLY() :-  Ahead of time, it's sometimes unclear how many arguments will be required when calling a function.  In such instances, the apply() method is h

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, "

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

Hello Guys, In this blog we are going to learn about CanActivate method in angular. A ngular is a highly capable framework for the web which enables the development of web apps that are both interactive and dynamic. A fundamental component of Angular is its capability to regulate access to particular portions of an application in accordance with a user's permissions or roles. Powering this feature is the CanActivate method, which is a native type of protection in Angular and ensures that routes are safeguarded. Angular's CanActivate method can play a vital role in secure application development. Let's explore it further in this blog. CanActivate, what is it? Angular's CanActivate interface is a guard that's quite handy when it comes to securing routes. With this interface, you can control who's got access to a particular route by checking if the user meets certain conditions. For example, you could require that the user is authenticated or has the right pri

What is Pipes in Angular? Built in Pipes with examples and how we can create custom pipe using angular

Hello Guys, In this blog you're going to learn about Angular Pipes with in-built pipes and and customized pipes with details understanding. As an Angular developer, you often come across situations where you need to transform data before displaying it to the user. For instance, you might want to format a date, display a currency in a specific format, or filter a list of items based on some criteria. This is where Angular Pipes come into the picture. Angular Pipes are built-in features that allow you to transform data easily and efficiently. What are Angular Pipes? Angular Pipes are a built-in feature in Angular that allow you to transform data in the template. A pipe takes in a value or values and returns a transformed value. The transformed value is then displayed in the template. Angular Pipes are similar to filters in AngularJS. However, they are more powerful and flexible. Angular Pipes can transform data in a variety of ways, including formatting, filtering, sorting, and more.

How to configure Lazy Loading in REACT 16+

   In react we can achieve lazy loading after performing some steps. Let's start Step 1:- We need to import the Suspense component  - Now here I have imported Suspense component from react          import React, {Component, Suspense} from 'react'; Step 2: We need to change the way of importing Component in React - Now we are importing our other components here. I'm importing the Login and register component here. - Here we are using React.lazy() method  const Register = React.lazy(() => import('./containers/auth/register/register')) const Login = React.lazy(() => import('./containers/auth/login/Login')) Step 3: Now we need to declare our routes   Here we are using Suspence for declaring component.  <Route path={'/'} render={() =>  <Suspense fallback={<div>Loading....</div>}>             <Login />           </Suspense>} exact/>         <Route path={'/register'} render={() =>           <

What is React, JSX and why we need to use React-JS?

  Hey Guys, in this blog we are going to learn about what is REACT, JSX and why we need to use React. Let's get started... What is the React? ReactJS is an open-source front-end Java-Script library. it's free. It's maintained by Facebook. It's used for building user interfaces especially for Single Page applications (SAP). We can also use it for handling the view layer for Mobile and Web Applications. We can also create reusable component that we can re-use in our project What is JSX ? JSX Stand for JavaScript XML In react instead of java-script we are using JSX for templating. Using JSX we can write HTML in React application. it's made easy for developers to write HTML code in react app. It automatically converts the HTML tag into react element. Why we need to use  React? It's easy to learn Performance Data Binding Native Approach Simplicity Testability How to Install and create React APP? For more info just visit below link there you can find all information s

How to set up React Environment in local system with NodeJS Installation

Hello guys, in this blog we are going to learn how to setup   REACT - JS   environment in the local system Let’s get started There is  two  way we can install  React-JS 1) Using NPM Command 2) Using create-react-app In this blog, we are going to learn about the second way  create-react-app For that, we need to perform some steps Step 1: you need to install node js and npm by using the below link                                         https://nodejs.org/en/ Step 2: Install React By using the below command we can install react JS  npm install -g create-react-app After successfully install the above command now we can create react app Step 3: Create react app  for creating react app you just need to use the below command and need to enter your project name like below. create-react-app all-in-one After successfully create project you will get the below screen Step 4: Run React App For that, you need to go into a specific folder location and after that need to run the below command to run

What is Meta data and different types of meta data in angular with names

Hello Guys, In this blog we are going to learn about Metadata in angular with examples. What is Meta Data ?  Basically meta data is used to decorate a class so that it can be configure the expected behaviors of the class in angular. Basically In angular we have total 4 type of meta data 1) Class Decorator  :- Like @Components and @NgModule 2) Property Decorator : - It's mainly used for properties inside a classes.      Ex:-  @Input() & @Output() 3) Method Decorator :- It's mainly used for methods inside a classes.      Ex:- @Hostlistner() 4) Parameters Decorator :- It's mainly used for Parameters inside a classes.      Ex:- @Inject() If you guys have any query then you can drop a mail to us on this mail id: techoswag@gmail.com

Configure and Build Angular application for different environments like QA and Staging

 Generally in the angular application by default, we have two environment  1) Development  2) Production Environment.  But In some cases, we need to add other environments for our application like QA and staging environment.  So let's see how we can add multiple environments in angular application for that we have to perform some steps.  Step 1:- Custom Environment File - Here For every target environment, we have to create a new file under  the environment folder  here i have created two files  evnironment.qa.ts  and  environment.staging.ts Step 2:- Custom Environment Setting - Here now you have to configure your  environment name  and new environment API URL and other settings For Example:- Step 3:- Need to Update the angular.json file - Now in the angular project you can find  the angular.json  file. in that file, you have to configure your new environment like below Here I have configure for QA environment Step 4:- Build an Application For the new environment - Now to build app