Questions tagged [angular-standalone-components]
58 questions
1
vote
2 answers
Angular 16 Standalone component, "Can't bind to 'formGroup' since it isn't a known property of 'form'"
This is not the usual module-related. Because I'm using Angular v16, standalone component, no module is required.
TS
import { FormBuilder, FormGroup, FormControl, Validators, FormsModule } from '@angular/forms';
@Component({
selector: 'app-x',
…

Jeb50
- 6,272
- 6
- 49
- 87
1
vote
2 answers
Angular HttpClient calls api twice when an HttpInterceptor is set
I have set a HttpInterceptor for setting an api key in the request headers:
export const authInterceptor: HttpInterceptorFn = (req, next) => {
console.log('authInterceptor');
console.log('request', req.method, req.url);
req = req.clone({
…

mattinsalto
- 2,146
- 1
- 25
- 27
1
vote
1 answer
How do I make the Prime MessageService work in the Interceptor of an Angular application that only uses Standalone Components?
I'm trying to implement a global error notification but I'm not managing to inject anything into the Interceptor and the worst thing is that it doesn't give an error, it just doesn't work, if anyone can shed some light, I'd appreciate it, below…

Brendon Santos
- 21
- 3
1
vote
2 answers
How can I use a standalone custom directive within a non-standalone component in Angular?
Using a standalone custom directive in a NOT standalone component
I created a custom structural directive and I want to be able to reuse it in different componentsa.
Everything works fine when it's not standalone, but when I add standalone: true…

Hades
- 33
- 5
1
vote
2 answers
How to import angular innerHTML in standalone component
With the new standalone component, in Angular 15, we can now import dependencies directly in the @componentdeclaration.
We can also import only NgIf instead of the CommonModule to make our component more three-shakable.
But I was wondering how to…

Raphaël Balet
- 6,334
- 6
- 41
- 78
1
vote
1 answer
installing firebase on ionic angular 7 project
I used ng add @angular/fire to add firebase to ionic angular 7 project. When I checked the package.json file I found only @angular/fire without firebase package and rxfire package.
Also creating the ionic app generated standalone version of angular…

Xyz.WebDeveloper
- 31
- 7
1
vote
1 answer
Error when trying to import a standalone component in a module
I recently upgraded my project from Angular 13 to Angular 15. And now I'm trying to make some of the existing components independent.
I'm trying to use a standalone component in a regular NgModule but I get this error:
Class…

mahbub kh
- 41
- 5
1
vote
1 answer
How to provide generated Routes using ROUTES InjectionToken in a module-less Angular App?
I'm converting to Standalone Components and as they suggest to convert the routes to that:
// In the main application:
export const ROUTES: Route[] = [
{path: 'admin', loadChildren: () => import('./admin/routes')},
// ...
];
// In…

mnewmedia
- 485
- 1
- 6
- 20
1
vote
1 answer
Testing Angular 14 Standalone Components with Spectator
Our test runner is Jest.
Our component is marked as standalone: true,
If try to set up spectator like this:
describe('OurComponent', () => {
let spectator: Spectator;
const fakeActivatedRoute: ActivatedRoute = {
…

Andreas Lauer
- 15
- 4
1
vote
1 answer
Angular 15 Standalone AppComponent and AngularFireAuth
I am trying to set up an Angular webapp where the AppComponent is standalone itself using Firebase Authentication (and database). Therefore no NgModules.
I added in the main.ts
bootstrapApplication(AppComponent, {
providers: [
…

Vale
- 35
- 5
1
vote
1 answer
angular generic type inside standalone component
Dynamic icon standalone component
I try to create dynamic icon component that at any module fill with a new set of assets.
I want to send it new enum and get appropriate input type intelligence.
import { CommonModule } from '@angular/common';
import…

Mor Bargig
- 198
- 1
- 7
1
vote
0 answers
How can I test routerLinkActive in standalone component?
If I have a non-standalone component as follows:
import { ChangeDetectionStrategy, Component } from '@angular/core';
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'sb-index',
template: `

peinearydevelopment
- 11,042
- 5
- 48
- 76
0
votes
0 answers
Angular standalone component importing module error
Component imports must be standalone components, directives, pipes, or must be NgModules. Here treemodule is up to date but still getting the error . this is the error caused in component
This is he error caused in main.ts
Answers for the above…
0
votes
1 answer
Angular 16 standalone url always routs to home page
My Angular 16 app is pure standalone, no ng modules at all.
I configured routes, and when used within components as links (e.g.: routerLink="/team") it routes to the correct page, and the URL changes accordingly.
However, trying to reach a page…

Mor Sagmon
- 905
- 1
- 16
- 35
0
votes
1 answer
migrate an existing angular project to standalone components - no options available
I'm on angular version 15.2.4 and decided to use the migration tool to convert my components to standalone compoonents.
The issue I'm having is when I run the command: ng g @angular/core:standalone
I never get the option to select any of the modes…

tercou1
- 113
- 2
- 11