2,075 questions
0
votes
2
answers
44
views
Angular login page result not updated immediately after login action
My LoginComponent:
import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-login',
standalone: false,
templateUrl: './login....
1
vote
1
answer
53
views
Checking if app-custom exits in Angular html template
I think I have a knot in my brain, it can't be that difficult.
I have an Angular component and it is called in my app.html
<app-custom></app-custom>
and if app-custom does not exist, a ...
1
vote
1
answer
113
views
Angular 19: TypeScript Error with Conditional Type Checking in Dynamic Table Component
I have a dynamic table component in Angular 19, which is built using a TableConfig object. This configuration creates the table's structure, including headers, columns, and rows. The rows property of ...
1
vote
1
answer
208
views
Why are components' imports not loading in Angular 19 SSR?
I've run into a problem that my header's imports are not loaded properly in SSR.
In my Angular 19 application the app.component.html includes a static <app-header> component that should exist on ...
2
votes
1
answer
70
views
Angular Youtube - onReady
I am trying to wrap Angular/Youtube component, described here.
This stackblitz is the result.
The problem here is that
<youtube-player
#musicPlayer
[videoId]="extractVideoId(videoId)"
...
2
votes
1
answer
42
views
How do I make a child component not render the extra <app-child> node?
I have a parent component whose template is basically this:
<table>
<thead>
<tr>
<th>Data 1</th>
<th>Data 2</th>
</tr>
</...
0
votes
2
answers
60
views
Angular 15: Extract a component from a lazy loaded module for dynamic creation
Let's say I have a module with components and services which should only be loaded if a specific feature flag is true. The app.component checks for the feature flag and in its template has a component ...
2
votes
2
answers
691
views
Why does my Angular dropdown update selection even when the parent does not store the selected value?
I have an Angular dropdown component (CustomDropdownComponent) that receives a list of options and a selected value from its parent component via @Input(). The parent also listens for selection ...
1
vote
2
answers
152
views
How to apply component CSS to dynamically injected HTML from an API?
I am receiving an HTML string from an API response and need to render it inside my Angular component while keeping the component's CSS styles applied.
What I have tried:
Using [innerHTML], but the ...
1
vote
2
answers
81
views
Why don't my angular components realise that it's part of a module?
Disclaimer: I may be wrong about my understanding of this seeing as I have only been using Angular for little over a year (Angular 16.0.0).
Code
I have this component (SidebarComponent):
@Component({
...
0
votes
3
answers
632
views
Updating of an Angular computed signal occurs only once but not for future dependencies update
I'm trying to filter an array based on the value of a signal , I think computed signal is the best option for this purpose. My goal is to show only the results that match (via a custom filtering ...
0
votes
1
answer
110
views
How to update a component in Angular using a backend request, without refreshing the page?
I want to update my heart icon, which bound to every product, to add to favourites.
<i class="fa-regular fa-heart" *ngIf="!isFavourite"></i>
<i class="fa-...
1
vote
1
answer
74
views
Angular Components Structure in Divs
I am questioning myself of whether or not to structure my Angular components in sub divs, to make the html better.
I do have a main page and a overview component. Is it good practices in Angular to ...
1
vote
1
answer
72
views
Access child component from dynamically created component - Angular 12
Inside global-component I have method for dynamically creating component
const comFactory = this.resolver.resolveComponentFactory(ParentComponent);
const component: any = this.componentContainer....
1
vote
1
answer
275
views
Angular 18 component does not work as expected with blobs
I have an angular 18 project which pulls the image data from an API to dispaly's it on screen. Can someone help me understand this behaviour?
The app throws an exception 'document is not defined' with ...
2
votes
4
answers
349
views
How to style Angular parent and child component
I'm learning Angular 18 while I already know React. I have a "pretty big" HTML file, which I would like to split. Let's take this pseudo and minified example:
<ul>
<li>Hello<...
0
votes
1
answer
92
views
How to Apply a default attribute to an angular component
I'm trying to format some fields into neat rows and columns, and because I have to match some other components with very specific formatting, the html that works looks like this:
<div fxLayout=&...
0
votes
0
answers
52
views
Search by field that contains button and mat-menu not showing inside of table
I am working on creating a Search by field that when clicked on will have a check box to search by address. It is a button with mat-menu component. I want to add it inside of the app-table-actions ...
0
votes
1
answer
77
views
Angular event listener updates class properties but not template
New to Angular (using 18.2) and trying to get callbacks from mouse events on an svg working. The code is like this:
component.html
…
<object data="image.svg" type="image/svg+xml&...
1
vote
1
answer
254
views
Deprecated ComponentFactoryResolver, Trying to use ViewContainerRef
I am trying to setup my auth.component.ts file to use ViewContainerRef from the placeholder.directive.ts file, but I am unsure what I need to populate inside the createComponent() at the end of the ...
1
vote
1
answer
157
views
How to Override a Component from a 3rd Party Library in Angular?
I'm using an internal library that provides a generic solution for authentication, including a login page with a login form. For a specific application, I need to customize the login form by adding ...
0
votes
0
answers
88
views
Angular component not disposed after OnDestroy
I have a component with a signal state:
array: WritableSignal<string[]> = signal([]);
I want the array to be removed from browser memory because the array can get quite big, and the component ...
-1
votes
1
answer
2k
views
Angular 18 component not being recognised/shown
I started making an Angular 18 app and I added my first component (using standalone components) and the app seems to not recognise my component because when I add it in my app.component.ts as a HTML ...
2
votes
2
answers
304
views
How can I use multiple instance of ngx-mat-select-search without checking for input array length?
I made a reusable ngx-mat-select-search component which looks like this
mat-tooltip-select-all.component.ts
export class MatTooltipSelectAllComponent implements OnInit, AfterViewInit, OnDestroy {
@...
-1
votes
1
answer
161
views
Is it possible to render Angular component dynamically using Selectors?
`Is it possible to render an Angular component dynamically? For example, I have component selector names in my .ts file. When I bind the variable in the .html file using interpolation and innerHTML, ...
1
vote
0
answers
161
views
ViewChild change detection throws ExpressionChangedAfterItHasBeenCheckedError
I have custom Angular Component modal-component that serves as a proxy for MatModalDialog with ngTemplateOutlet as body for mat-dialog-content.
<mat-dialog-content class="modal-dialog-medium&...
1
vote
2
answers
1k
views
Dynamically inject HTML with Angular code, into existing DOM
I am using Bootstrap Tables in an Angular app. To render custom buttons in a cell, I have to write the HTML code from the Angular Component, defining the HTML as a string. However in this way, I can't ...
0
votes
1
answer
780
views
Angular component not loading in the browser due to Observable subscription
In this component when I call the getCurrentSalahOrIqamah function in the ngOninit so my component is not loaded in the browser. and keep stuck.
I tried with both lazyloaded eager loaded component but ...
1
vote
1
answer
59
views
Confusion regarding scope of button inside angular
(click) event in one instance of a component is triggering function in another instance. I don't know how to explain this. I've attached a stackblitz example.
Clicking on both the buttons print same ...
-1
votes
1
answer
253
views
Why does the Angular constructor run before ngOnChanges even though it's not a part of the lifecycle hooks?
I've noticed that in Angular, the constructor of a component runs before the ngOnChanges hook, despite the constructor not being considered a part of the lifecycle hooks. Could someone explain why ...
-2
votes
1
answer
111
views
angular project ( html , css & js codes )
In my angular project , i have 4 components (comp1,comp2,comp3,comp4), i found a code of form (html , css & js ) and i wanna put it in comp1, so tell me if i'm right or not : do i put the html ...
0
votes
2
answers
2k
views
VS Code -> Angular: create a new component without spec file
fellow developers!
I am using VS Code (latest version) for my Angular (17) app.
I can right-click a folder and select the "New component" option to automatically create a new Angular ...
0
votes
1
answer
123
views
Why to use @input @output over subject/services?
Generally while passing data from child to parent or parent to child we use @input and @output
what are the benefits @input and @output have over subject or services apart from it's the most organic ...
0
votes
2
answers
143
views
Pass key-value pairs of object as individual arguments to component in Angular
Assume i have a component that takes three inputs input1, input2 and input3
export class testComponent {
@Input() input1:string;
@Input() input2:string;
@Input() input3:string;
....
...
}
...
0
votes
1
answer
3k
views
Angular 17 - ng build - dist folder generation
I have developed a project using the Angular 17 tool. This was creating the two sets of folders for the server and browser during the creation(build) of the dist folder. That was not the case with the ...
0
votes
0
answers
107
views
Dynamic Angular component with template from string
I have to dynamically (at runtime) create a component with template built of string. This string contains some tags that need to be replaced by Angular components.
For example
HTML template:
<div ...
0
votes
1
answer
50
views
Angular Async Validators sent to Dumb component
You define the FormGroup in the Dumb component to keep related data together. Then you need async validators on some form controls, but dumb component should not have service calls. One option is to ...
0
votes
0
answers
469
views
'signals' does not exist in type 'Component'
I'm trying to use Angular Signal Based Components feature. Just seen this on Angular Signal Based Components. How do I use signals: true property in component decorator? with v17 release and see the ...
1
vote
1
answer
90
views
Angular 2 Child Route On Library Component Not Running
I have a demo app I am using to test a custom library I have created. I am importing my library and using the custom component in the demo app and that is running just fine, but I can't get the child ...
0
votes
0
answers
330
views
Angular Dynamic component with ngComponentOutlet not fully rerendered
When using *ngComponentOutlet to render dynamic components in Angular, everything works fine until you do not switch component type.
If the component type you pass to the *ngComponentOutlet directive ...
2
votes
2
answers
3k
views
How do I create an angular component as part of a library and use it in my application
So I have the following situation
I have created an angular library ng generate library my-lib
I have added a simple component using Ng generate component .lib/test which creates a standalone ...
1
vote
2
answers
364
views
Is it possible to display Angular component using Angular Interpolation?
I have an Angular component that I depend on. This component has a getData method, then this method is called in the template of this component, and the result is displayed using Angular interpolation....
-1
votes
1
answer
178
views
The tailwind part of the classes does not work, but only on one Angular 17 page
I was just writing code without making any global changes, and suddenly my tailwind broke. Namely, its class "p" and derivatives. Padding just stopped working for me. But not in all elements,...
3
votes
3
answers
4k
views
Problems with atribute components like ngClass or ngStyle
I'm new to Angular 17 and I've noticed that every time I want to use an ngClass attribute or an ngStyle I get an error like it doesn't recognize them and I get this error
NG8002: Can't bind to '...
3
votes
2
answers
3k
views
Using styleUrls instead of styleUrl in component Angular 17
How to set styleUrls instead of styleUrl in component by command ng generate component?
In Angular 14, styleUrls property in the component decorator was set automatically after component generating. ...
1
vote
0
answers
402
views
Angular 16 - Router outlet activate event
We migrated our angular application from angular v13 to v16. The component's lifecycle events were working fine in v13, but having an issue in v16 when routing from one component to another.
In our ...
1
vote
1
answer
55
views
Why does my change not appear in my angular component when changed in parent component?
I started creating my own select component with the following input:
@Input() options: SelectOption<UserRole>[] = [];
The parent (user editor) using this select component gives following ...
2
votes
0
answers
354
views
How to create an Angular component that can act as either a Material Dialog or a Material Bottom Sheet, depending on the screen size?
I'm trying to create an Angular component that is a Mat Dialog when the screen is bigger than 500px and Mat Bottom Sheet when the screen is lower.
The following code is just a basic example of the ...
1
vote
1
answer
68
views
Angular variable reference persistence behavior after setting singleton instance to Undefined
I have this class, meant to work as a singleton,
export class SingletonClass {
public static instance: SingletonClass | undefined;
public name: string | undefined | null;
static ...
1
vote
1
answer
533
views
Passing dynamic TemplateRef in NzMessageService - Angular 15
I'm working on an Angular application where I'm using NzMessageService from Ng-Zorro Ant Design to display messages. I'm trying to pass a dynamic TemplateRef to the NzMessageService but facing some ...