Questions tagged [angular-standalone-components]
58 questions
5
votes
3 answers
Unexpected synthetic property @transitionMessages found with standalone compoent angular 15
I am migrating the angular application to the standalone component. Removed the ngModule and app.module.ts file
main.ts
bootstrapApplication(AppComponent,{
providers:[importProvidersFrom(FalconCoreModule.forRoot(environment)),
…

San Jaisy
- 15,327
- 34
- 171
- 290
5
votes
2 answers
Mock standalone directive in a standalone component
I'm trying to write a unit test for a standalone component and mock its dependency. This standalone component has the following content:
import { Component, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import {…

Georgian Stan
- 1,865
- 3
- 13
- 27
5
votes
2 answers
How to use Ngxs is a standalone component?
Is it possible to use Ngxs in a standalone component? I've tried importing the NgxsModule in the following ways:
@Component({
...
imports: [
...
NgxsModule.forFeature([MyState]),
...
and
@Component({
...
imports: [
...
…

Jake Smith
- 2,332
- 1
- 30
- 68
4
votes
1 answer
Angular 15 Ref Error: Cannot access 'Component A' before initialization
I am facing one issue while importing standalone component within each other.
Component A.
@Component({
standalone: true,
selector: 'app-a',
templateUrl: './a.component.html',
styleUrls: ['./a.scss'],
imports: [
BComponent
…

Mantu Nigam
- 3,690
- 7
- 24
- 41
4
votes
1 answer
NullInjectorError - Root standalone component does not import HttpClientModule properly
I have an issue, I want to rewrite my app code and change main module to main root standalone component pointed in main.ts.
All works fine but I have an issue with HttpClientModule. I am using HttpClient in one of services which is provided in…

Patryk
- 377
- 2
- 19
4
votes
1 answer
How can I import a module into standalone directive
The imports attribute is available on the @Component decorator but not on the @Directive decorator.
Is there another way to import a module into a standalone directive ?

Matthieu Riegler
- 31,918
- 20
- 95
- 134
3
votes
1 answer
Anyone try using InMemoryWebAPI with standalone components?
I am using Angular v16 with standalone components. I implemented InMemoryWebAPI as I have in NgModule-based projects, but it doesn't seem to be working. I keep getting 404 not found.
Anyone try this and have success with InMemoryWebAPI with…

DeborahK
- 57,520
- 12
- 104
- 129
3
votes
3 answers
How to configure Angular v15.2 standalone application with MSAL
Before in ngModule base angular application you use to add MsalRedirectComponent in the bootstrap property of AppModule :
bootstrap: [AppComponent, MsalRedirectComponent]
Now in V15.2 the AppModule have been replace by the boostrapApplication…

Dadv
- 324
- 2
- 17
3
votes
1 answer
What's the equivalent of CanLoad guard for standalone components?
Before Angular 15, I used SCAM pattern in order to have one module per component/directive/pipe.
My app contains many lazy loaded pages (one module per page) with a CanLoad guard to prevent lazy loading (feature flags, ...).
Since Ng 15 (I'm on…

Adrien SAULNIER
- 1,651
- 1
- 13
- 19
2
votes
0 answers
NGRX Feature state (slice) in standalone components without providers in route config
Need help, is there any way to create feature slices for ngrx state without putting in route block for standalone components. previously we have NgModule approach to achieve the same.
@NgModule({
declarations: [
],
imports: [
…

Mantu Nigam
- 3,690
- 7
- 24
- 41
2
votes
1 answer
NullInjectorError: No provider for HttpBackend
enter image description here error
enter image description here main.ts
enter image description here app-config-service.ts
after i replaced bootstrapModule with bootstrapApplication in main.js and moved all providers in app-module to main.ts. i got…

mahbub kh
- 41
- 5
2
votes
1 answer
Angular standalone component's providers not working or not applied
I have a standalone component and I'd like to open a modal from in it (which is another standalone component but it is not matter now I guess).
I want to apply global rules for the material dialog, so I provide it in my component's provider. But it…

Procisz
- 21
- 5
2
votes
1 answer
Error when trying to load a "standalone" component from a module
I want to inject new standalone component CrashReportsComponent into my project. But I get an error when I try to connect a component from module-routing that the component type is not like NgModule
NgModule 'CrashReportsComponent' is not a subtype…

Anton Kazakov
- 23
- 1
- 3
2
votes
0 answers
What are the advantage of writing angular app using standalone components
I have seen many docs regarding standalone components creation and its usage.
But i havent found any doc stating the advantages of standalone components implementation against ngmodules approach.
We can get rid of too many module s creation and…

bvakiti
- 3,243
- 4
- 17
- 26
2
votes
1 answer
How to use Standalone Components, Pipes, or Directives in feature modules
I updated my angular project to angular 14. Now I want to have some standalone components, pipes, or directives.
I have a featured module named ProductModule and want to use a standalone pipe called uppercase in this module.
// structure
---Product
…

Abolfazl Roshanzamir
- 12,730
- 5
- 63
- 79