Skip to main content


nullinjectorerror no provider for httpclient angular 17

In Angular 17 where the standalone true option is set by default, the app.config.ts file is generated in src/app/ and provideHttpClient(). We can be added to the list of providers in app.config.ts Step 1:   To provide HttpClient in a standalone app we could do this in the app.config.ts file, app.config.ts: import { ApplicationConfig } from '@angular/core'; import { provideRouter } from '@angular/router'; import { routes } from './app.routes'; import { provideClientHydration } from '@angular/platform-browser'; //This (provideHttpClient) will help us to resolve the issue  import {provideHttpClient} from '@angular/common/http'; export const appConfig: ApplicationConfig = {   providers: [ provideRouter(routes),  provideClientHydration(), provideHttpClient ()      ] }; The appConfig const is used in the main.ts file, see the code, main.ts : import { bootstrapApplication } from '@angular/platform-browser'; import { appConfig } from '
Recent posts

Taste of India: Where to Find Authentic Indian Food Experiences Across Europe

Taste of India: Where to Find Authentic Indian Food Experiences Across Europe Europe is one of the favorite vacation destinations for travelers from all over the world. There are many architectural monuments and beautiful landscapes to be found here. You can meet people from different parts of the world and learn about different cultures and traditions. A huge network of restaurants with national cuisine from different countries is no exception. Many people like Indian food in Europe , and tourists are often interested in it. Popular Indian restaurants in Europe you should visit This list will be useful both for tourists who want to try something new and for Indians who are currently in Europe and want to try some traditional food. Nirvana India, France After an exhausting day of visiting the most popular tourist spots, such as the Eiffel Tower, you'll want to eat something delicious. The Nirvana Inde restaurant is the perfect place to go if you want to try Indian food. L

The Best AI Essay Generator to Maximize Your Writing Skills

The Best AI Essay Generator to Maximize Your Writing Skills AI has revolutionized so much that it is slowly becoming a fundamental part of our lives. AI tools have proven to be helpful to writers, aiding them in a variety of ways: brainstorming ideas, checking their spelling and grammar, boosting productivity, and unlocking new writing techniques. In this article, we will highlight the best AI generator if you want to maximize your writing skills and dwell upon the main ways in which AI generators can help you craft better pieces. What Is the Best AI Essay Generator to Improve Your Writing Skills? If you’ve been searching for a perfect AI essay generator, look no further. This AI Essay Generator by Custom Writings has everything you need. The tool is very simple to use. It helps you beat writer’s block, format your paper correctly, and cite scientific resources. The tool will become indispensable to every student struggling with such tasks. How you can use the AI essay generator

Automating Data Extraction: How Image-to-Text Conversion Can Improve Your Workflow

In this blog post, we’re going to be talking about how data extraction works, how images are converted to text, and how it can be leveraged to improve your workflow. What is Data Extraction? Data extraction is a broad and general term that refers to taking information from a source and presenting it in another style or format. It can refer to the process of analyzing some data and extracting the trends and patterns it contains. In a professional setting, there are many different ways in which data extraction is used, and there are many different benefits that it can provide. One of these ways of data extraction is image-to-text conversion.   What is Image-to-text conversion, and how does it work? Converting images into text basically refers to taking the text written inside an image and converting it into digital text. For example, if there is a poster that contains guidelines or any other type of lengthy textual content, an image-to-text conversion would take out all the te

No directive found with exportAs 'ngForm'.ngtsc(-998003)

 At the time of Reactive Forms Validate, I got this error: No directive found with exportAs 'ngForm'.ngtsc(-998003) After that, I added to ReactiveFormsModule in the imports[] array to resolve this error. import { CommonModule } from '@angular/common'; import { NgForm,FormsModule, ReactiveFormsModule } from '@angular/forms'; In Component class, imports: [RouterOutlet, FormsModule, ReactiveFormsModule, CommonModule] Example, import { CommonModule } from '@angular/common'; import { Component } from '@angular/core'; import { NgForm,FormsModule, ReactiveFormsModule } from '@angular/forms'; import { RouterOutlet } from '@angular/router'; @Component({   selector: 'app-root',   standalone: true,   imports: [RouterOutlet,FormsModule,ReactiveFormsModule,CommonModule],   templateUrl: './app.component.html',   styleUrl: './app.component.css' }) export class AppComponent {   title = 'Form Validation';   form =

Angular 17 Encrypting and Decrypting Data with Crypto-js

First, let's install crypto-js in our Angular project using NPM: npm install crypto-js npm i --save-dev @types/crypto-js Once CryptoJs is installed, we can import it into our Local Service (EncrDecrService): import * as CryptoJS from 'crypto-js'; Now we will add two encrypt and decrypt methods to handle encryption and decryption in our service class: import { Injectable } from '@angular/core'; import * as CryptoJS from 'crypto-js'; @Injectable({   providedIn: 'root' }) export class EncrDecrService {   //Private Key   key = "encrypt!135790";   //constructor   constructor() { }     //To encrypt input data   public encrypt(password: string): string {     return CryptoJS.AES.encrypt(password, this.key).toString();   }   //To decrypt input data   public decrypt(passwordToDecrypt: string) {     return CryptoJS.AES.decrypt(passwordToDecrypt, this.key).toString(CryptoJS.enc.Utf8);   } } Using this s

Reactive forms validation in Angular 17 | Custom validation in reactive form | Angular 17 directives

First, we must import to NgForm, FormsModule, ReactiveFormsModule, and CommonModule which will help us validate the Reactive forms in Angular 17. import { CommonModule } from '@angular/common'; import { NgForm,FormsModule, ReactiveFormsModule } from '@angular/forms';   After that imports in the Component, imports: [RouterOutlet, FormsModule, ReactiveFormsModule, and CommonModule]   See the example code for app.component.ts, import { CommonModule } from '@angular/common'; import { Component } from '@angular/core'; import { NgForm, FormsModule, ReactiveFormsModule } from '@angular/forms'; import { RouterOutlet } from '@angular/router';   @Component({   selector: 'app-root',   standalone: true,   imports: [RouterOutlet, FormsModule, ReactiveFormsModule, CommonModule],   templateUrl: './app.component.html',   styleUrl: './app.component.css' }) export class AppComponent {     ti

Angular 17 Feature: deferred loading @defer

Using @defer in Angular 17 to implement lazy loading. Angular 17 introduced a new @defer block that lets you lazy-load content based on specific conditions or events. Lazy loading is a technique that enables web apps to load resources (such as scripts) only when they are needed. Using @defer with a declarative trigger condition Deferred blocks support the following declarative trigger types: 1.       on interaction 2.       on hover 3.       on idle 4.       on timer 5.       on viewport Let's create an example for all of these! @defer on interaction Angular renders the on interaction block when the user interacts with its @placeholder block. An interaction can be a click, focus, or input event, like keypress: @defer (on interaction) {   <span>Clicked - on interaction </span> } @placeholder {   <span>Placeholder - on interaction (click on it!) </span> } @error {     <span>Error</span> } @loading(minimum 2