Friday, August 1, 2025

How to Do Cross-Browser Testing on Windows — Including Safari via Playwright

To test follow few steps:

Step 1. Install node
Step 2. create Folder and run these commands

commands


Step 3. update package.json 's scripts

package.json


Step 4. create Test folder in above folder and create file with name browser.test.ts and add below code

browser.test.ts


Step 5. run command npm run test:safari

Friday, July 18, 2025

How to Highlight a Link of Side Nav When It Has Multiple Child Links in Angular

๐Ÿ”— How to Highlight a Link When It Has Multiple Child Links in Angular

When building a sidebar in Angular, you might want to highlight a parent link when any of its child routes are active. Angular’s routerLinkActive only works for single routes — so here’s a quick 2-step solution using a custom directive.

  1. Step 1: Create a custom directive
    Write a directive that checks the current URL against a list of child links and adds an active class if any match.

Step 1: Directive Code

  1. Step 2: Use it in your template
    On your parent menu link, pass the list of child URLs to the directive.

Step 2: Template Code

✅ Works with multiple child links, query parameters, and is easy to reuse.

✅ This blog is written by TechJourney with Gagan, sharing practical Angular tips for developers.

Tuesday, July 1, 2025

Create Search Functionality using 2 steps using pipe in Angular

To Implement Search Functionality without writing code in ts file

Step1: Create a Pipe using below code.

Code Of Search Filter Pipe



Step2: write below code where you want to implement search like in drop down.

Code Snippet



In above code we use just
<input matInput  placeholder="Search Company" #searchInput /><br> 
based on referece variable we took input and pass to pipe | searchByFilter:searchInput.value:'organizationName'"

Thursday, June 26, 2025

๐Ÿงฉ Implementing a Lightweight Query Handler in .NET using GMediator fully free for commerical use

In modern .NET applications, maintaining clean architecture is critical — and that’s where the Mediator pattern shines. It decouples the request/response flow and promotes separation of concerns.

While libraries like MediatR are popular, sometimes you want something even lighter — with zero dependencies.

Enter: GMediator, a custom lightweight mediator implementation.


๐Ÿš€ What We’ll Build
In this blog, we’ll create a simple GET API using GMediator that returns a list of products stored in an in-memory store — no database, no ORM — just the core pattern in action.
๐Ÿงฑ Step 1: Define the Product Model

Code Snippet


๐Ÿ’พ Step 2: Create an In-Memory Store

Code Snippet


๐Ÿ“ฌ Step 3: Create the Query Request

Code Snippet


๐ŸŽฏ Step 5: Create the Controller

Code Snippet


๐Ÿงช Step 6: Register GMediator in Program.cs

Code Snippet


๐Ÿ’ก Final Thoughts
GMediator is a great option for internal projects, low-dependency APIs, or learning the Mediator pattern hands-on.
You can extend this by adding Create, Update, Delete, or integrating with a real database like SQLite or SQL Server.

Wednesday, June 11, 2025

Building a Scalable .NET Backend Using Clean Architecture (With Optional Layers) in just an second

If you're building a new .NET backend, Clean Architecture is the best way to keep your code organized, scalable, and future-proof.
๐Ÿงฑ What is Clean Architecture?
It's a way to structure your project into layers:
Domain – core business models
Application – commands, queries, interfaces
Infrastructure – external services (API, logging, etc.)
Persistence – database (EF Core, SQL)
API – controllers
Tests – optional unit/integration tests
⚙️ Script-Based Setup
You can auto-generate this structure using a simple CMD script.
✅ You choose what to include:
Want Infrastructure? Type y
Need Tests? Type n
Want to skip Persistence? Type n




Steps To use:

1. use notepad save below code as setup-architecture.cmd

Code Snippet


2. save this file in respective folder where u want your project files
3. open cmd at this location and run this script by just type its name only that is setup-architecture.cmd

Wednesday, May 28, 2025

๐Ÿ”„ How to Extend Component Logic and Template in Angular (Simple Guide) => use of extends and ngTemplateOutlet

When building Angular apps, you might have common logic or reusable layouts across components. Instead of duplicating code, you can use extends in TypeScript and ng-template + ngTemplateOutlet in HTML.

Let’s walk through a simple example with 2 components where one extends logic and also injects custom HTML.


✅ Step 1: Create a Child Component (as base layout)

This is the reusable component that contains a common layout and logic.

child.component.ts

child.component.html

  • ✅ Layout and logic are defined here.
  • ✅ Accepts external HTML through contentTemplate.

✅ Step 2: Create a Parent Component That Extends Child

This component inherits logic from ChildComponent and injects its own template content.

parent.component.ts

parent.component.html

  • ✅ Inherits logic like title and getTitle() from ChildComponent.
  • ✅ Injects its own content via ng-template.

✅ Final Output

  • ChildComponent provides the reusable layout.
  • ParentComponent injects dynamic HTML and extends the logic.
  • This keeps your code DRY, clean, and scalable.

Use Cases: shared card layouts, reusable modal structures, dashboards, etc.

Friday, May 2, 2025

๐Ÿงน How to Remove SSR (Server Side Rendering) from an Angular 19 Project

Sometimes you add Angular SSR using @angular/ssr, but later want to return to a clean client-side app. Here's how to fully remove SSR (Server-Side Rendering) from your Angular project. ๐Ÿ”ฅ Step 1: Delete SSR Files Remove these files from the src/ folder: main.server.ts app.server.module.ts server.ts Any .server.ts files like: app.routes.server.ts app.config.server.ts ๐Ÿ› ️ Step 2: Update angular.json Inside "architect > build > options", remove the following: Also remove the entire "server" block from angular.json if it exists. ๐Ÿงพ Step 3: Clean Up TypeScript Config ❌ Delete: tsconfig.server.json ✅ Edit tsconfig.app.json like this: ๐Ÿงน Step 4: Uninstall SSR Dependencies ๐Ÿ–ฅ️ Run in Terminal / PowerShell / CMD: ๐Ÿš€ Step 5: Clean & Serve PowerShell (Windows): Mac/Linux terminal: ✅ Done! Your Angular app is now SSR-free and runs entirely with Client-Side Rendering (CSR) — faster dev, fewer headaches!

How to Do Cross-Browser Testing on Windows — Including Safari via Playwright

To test follow few steps: Step 1. Install node Step 2. create Folder and run these commands commands Copy Code ...