Skip to main content

Posts

Showing posts with the label angular4

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.

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

What is DATA-Binding in Angular? Different types of data binding with details examples and understanding

Hey Guys, In this blog we are going to learn about data binding in angular with examples.

What is the Lazy-loading in Angular and Different between Old syntax and New Syntax of Lazy-loading with examples

Hey Guys, In this blog we are going to learn about How we can use Lazy-loading in angular with examples. We are also going to learn the different syntax of lazy loading in angular . Lazy loading is used to load the specified module once the routes match. It will load the modules once use access that particular section or modules in our application. Using lazy loading will improve the performance of our application and also decrease the load time of our application. Using lazy-loading will help to reduce the bundle size of the application. Lazy -loading Old syntax in angular 7 or lower version          {                path: "feature",                loadChildren:'./feature-module/feature-module.module#FeatureModuleModule'          }, Lazy -loading new syntax in angular 8+   {     path:'feature',     loadChildren:() =>  import('./feature-module/feature-module.module').then(m => m.FeatureModuleModule)   } For example, Let's say we create a mo

Angular2+ Life Cycle Hooks with Details Understanding and example

  Hey Guys, in this blog we are going to learn about Life Cycle of Angular 2+. Let's get started... There is total 8 life-cycle hooks Angular 2+ have 1) ngOnChanges:    - It's called after a bounded input property changes 2) ngOnInit: - This hook is going to call when an angular component is going to be initialized. - this hook  called only once  3) ngDoCheck:   - This Hook is called during every changed detection in component.    4) ngAfterContentInit :  - This hook is called after  content ( ng-content )  has been projected into the view. 5) ngAfterContentChecked:  - This hook is called every time when the projected content has been checked. 6) ngAfterViewInit:   - This hook is called after the component's view or ( child View ) has been initialize. 7) ngAfterViewChecked:  - This hook is called every time when the view or (Child View ) has been checked.   8) ngOnDestroy:   - This hook is called when the compon