Angular 19 will introduce a new reactive API called Resource API. The primary purpose of the Resource API is to load the resources, such as: Fetch data from the API Update data locally Asynchronously load local resource It should not be used for mutation such as POST operations. It should mainly be used to loadContinueContinue reading “Getting Started with the Resource API in Angular- Video”
Author Archives: Dhananjay Kumar
Implementing a Global Error Handler in Angular: A Step-by-Step Guide
In an Angular application, errors typically fall into two categories: Errors related to HTTP operations Errors resulting from invalid application operations, like attempting to divide by zero This blog post delves into incorporating a global error handler in an Angular application to manage runtime errors throughout the application effectively. When working with Angular applications, it’s common toContinueContinue reading “Implementing a Global Error Handler in Angular: A Step-by-Step Guide”
Key announcements from the Angular Team about Angular and its future at the ngPoland keynote
On November 6, 2024, I attended the Angular Team’s keynote at ng-Poland, Europe’s largest Angular conference. The keynote was presented by Mark Techson, Alex Rickabaugh, and Pawel Kozlowski from the Angular team. Here are some key features I gathered from the keynote announcement. These enhancements and additions are impressive and will significantly advance the AngularContinueContinue reading “Key announcements from the Angular Team about Angular and its future at the ngPoland keynote”
Which is more suitable to use, isNaN or Number.isNaN() in JavaScript
In JavaScript, NaN is a valid value of the number type. console.log(typeof NaN); // number When prompted to verify if a value matches NaN or not, you’ll encounter an irony: NaN doesn’t equate to itself. Therefore, standard equality comparisons are ineffective for checking NaN values. if(NaN === NaN){ console.log(“NaN is equal to NaN”); } elseContinueContinue reading “Which is more suitable to use, isNaN or Number.isNaN() in JavaScript”
Do you know about TypeScript keyof operator?
In TypeScript, the keyof operator creates a union type of all the known public property names of the given type. To understand the actual use case of the keyof operator, let us consider the below example. There is a type created with an interface, interface IProduct { id: number; name: string; price: number; stock: number;ContinueContinue reading “Do you know about TypeScript keyof operator?”
Choosing Between for..in Loops and Object.values() in JavaScript
To determine whether to use a for…in loop or Object.values, consider a scenario with two objects const Product = { name:”product1″, price:100, } const ProductInvoice = { invoiceno : “invoice1”, customer : “customer1”, } These objects are linked to each other in the prototype chain. Object.setPrototypeOf(ProductInvoice, Product); Now, you iterate and list the values withContinueContinue reading “Choosing Between for..in Loops and Object.values() in JavaScript”
Object.values to iterate JavaScript object properties
In JavaScript, you can display the values of all public enumerable properties of an object by using Object.values(). For instance, if you have an object like the one depicted below: const Product = { name:”p1″, price:100, } You can output the values of all properties by utilizing Object.values() like this: let p = Object.values(Product); console.log(p);ContinueContinue reading “Object.values to iterate JavaScript object properties”
Video – Partial Type in TypeScript
This video explains Partial Type in TypeScript. interface IProduct { name: string; price: number; } function SaveProduct(product: Partial<IProduct>) { console.log(product.name); console.log(product.price); } SaveProduct({ name: “Laptop”, price: 1000 }); SaveProduct({ name: “Mobile”, price: 500 }); SaveProduct({ name: “Tablet”}); https://www.youtube.com/watch?v=q5wE_QjBtVU
Reading Request Headers Across Multiple .NET Core API Controllers
I was working on creating a .NET Core-based API and came across a requirement to read a particular request header across the API controllers. To understand it better, let us say there are two API controllers, InvoiceController ProductController We need to read the value of a particular Request Header in both controllers. To do that,ContinueContinue reading “Reading Request Headers Across Multiple .NET Core API Controllers”
JavaScript Interview Ep # 1 – What is function expression and declaration
There are three ways a JavaScript function can be created. They are as follows: Function declaration Function expression Arrow function When you create a function as a declaration or statement, it gets hoisted at the top of the execution context and can be used before it is made. Example below: console.log(Foo()); function Foo(){ return “ReturnedContinueContinue reading “JavaScript Interview Ep # 1 – What is function expression and declaration”