67 questions
2
votes
1
answer
79
views
Angular input signal: how to accept `string | undefined` from parent but always get `string` inside the component?
I created this simple component that has two inputs that both accept a string and in theory should accept undefined because they have a default value.
@Component({
selector: 'app-child',
imports: [...
1
vote
1
answer
58
views
Is it possible to read stale data from an object passed by reference between parent and child components?
I'm working with Angular and have a scenario where a parent component passes an object (e.g., product) to a child component via property binding ([product]="product").
The child component ...
2
votes
2
answers
89
views
How to detect change in dynamic objects property?
I have 5 dynamic objects out of those 5, I am referring to only 2 here:
objCache.tab1.page1.status: when cache enable from tab
objCache.page1.status: when cache enable from page
In my html and .ts ...
1
vote
2
answers
73
views
Angular @input and @Output conflict
I made a directive in angular which is act as a time input and in template of component I repeated it based on an array of string.
The directive has an @Input that is the initial value which is set to ...
0
votes
0
answers
23
views
How to access child component form field in parent component angular
Parent Component ts
Obj1={ name:"foo" fname:"Bee"}
Obj2={field1: "data", field2:"data2" , filed3:"data3"}
html :
<form #f="ngForm">
&...
1
vote
0
answers
35
views
dynamically bind and call parent component method from child component in angular
I am getting error on tabMethod is not function child component
In the Parent component:
In the .ts file:
this.pillTabs = [
{ tabName: 'Subscribers', tabMethod: this.showSubscribers.bind(this) },
...
5
votes
1
answer
698
views
How can I set a default array value for a required Angular input signal?
When using Angular signal inputs if I want to specify a required input array
import { input } from '@angular/core';
values = input.required<number[]>([]);
I get the build error (StackBlitz)
...
1
vote
2
answers
392
views
In Angular 17+, how to pass signal<number | undefined> to a child component input signal<number>?
Say I have two parent & child components respectively:
Parent Component:
@Component({
selector: 'app-parent',
template: `<app-child [id]="id()"></app-child>`, // this gives ...
1
vote
1
answer
52
views
Unable to send the parameter value to another component using angular ng2-smart-table
I am using Angular ng2-smart-table and am having trouble sending the value of a parameter to another component. The value is coming through as undefined.
Actually, want to enable or disable the toggle ...
1
vote
2
answers
49
views
Angular insert default values into a library component
I'm wondering if it's possible to somehow insert default values into a component from a library (but not wrapping it into another component which does this) to set default values.
e.g. i don't want ...
1
vote
2
answers
92
views
Dynamic Component Outputs
I have 2 components in Angular, a parent and a child. I'd like the parent to be able to
pass an array of objects representing a clickable thing to the child
have the child component dynamically ...
1
vote
1
answer
113
views
How to share data between (multiple instances) of 2 unrelated components?
I have 2 unrelated components, a search bar and a table. I have a service that shares data between them. The problem is that I have multiple instances of the search + table components depending on the ...
0
votes
1
answer
40
views
Onclick of the list item button name should display which is in array
i have been trying to display the name of the array item onclick of the user button but onclick of that i m getting name of the user in console but not in page level
this is the app.component.ts file ...
1
vote
1
answer
2k
views
How to use angular's withComponentInputBinding for @Input and signal input/model to use their initial value if not set through router?
I feel like there is a happy median somewhere for the withComponentInputBinding option I am missing. Right now, I include it in providing my router in app.config, and any inputs I use that have ...
2
votes
2
answers
3k
views
How to read the array in an Angular signal when it changes to an input signal?
Note that this is using Angular 18.0.0.
I am updating code to change from an observer to a signal. Instead of watching the observer, I want it passed into the component as if it were @Input. As an ...