Questions tagged [angular-input]
49 questions
10
votes
3 answers
Angular Input() takes undefined after providing default value
Below is Input decorator used with 3 variables and assigned default values to each variable
@Input() score: number = 0;
@Input() text: string = 'test';
@Input() color: string = 'red';
This is how I am passing values to the component inside a…

Varun Sukheja
- 6,170
- 5
- 51
- 93
7
votes
4 answers
Angular mat-form-filed input disable autocomplete
I am using angular material for all my controls. We have a requirement to disable auto-complete so that any previously typed value will not show up.
I have my code as below. I tried autocomplete "off" "disabled" and other suggestions that I found…

indra257
- 66
- 3
- 24
- 50
7
votes
4 answers
Angular Change detection not working with ChangeDetectionStrategy.OnPush in HttpClinet.Subscribe
I have reproduced a simple stackblitz demonstrating the issue I have been having. The problem is that I have a parent component that passes a boolean to a child component. This boolean is an @Input on the child component. It is important to note…

Pat
- 255
- 2
- 4
- 16
4
votes
1 answer
Is it a good practice to change a component property marked with the Input decorator
I was trying to build a tab component in Angular and Vue. Vue screamed (threw an error in the console) when I changed the component's props. Angular seems fine with it.
export class TabComponent implements OnInit {
…

David Blay
- 527
- 1
- 3
- 14
3
votes
1 answer
How to use in Angular inside an arrow function an object property (deeper than 1st level) sent by input?
I'm using angular 7 and trying to do something in a child component : use the input property that can be at first level in the object or deeper.
My child component has this piece of code :
if (this.values.filter(obj => obj[this.matchPropertyName]…

pti_jul
- 432
- 1
- 5
- 18
3
votes
2 answers
nativeElement.Value changes in directive not being reflected for input/ngModelChange events at the moment
Trying to replace a special character of input, I ended up writing this simple directive:
normalized-input.directive.ts
@Directive({
selector: "[appNormalizedInput]"
})
export class NormalizedInputDirective {
constructor(private element:…

Efe
- 800
- 10
- 32
3
votes
3 answers
Give dynamic ID to a div which comes from other parent component
I have a chart component like below:

Hope
- 475
- 6
- 16
2
votes
1 answer
Angular 16: Can't get route input binding to work
Angular 16 introduced a new way to easily parse route information and I wanted to utilize it since it avoids boilerplate code. However, I just can't get it to work and I'm not sure what I am doing wrong.
As described in their documentation I added…

hullunist
- 1,117
- 2
- 11
- 31
2
votes
2 answers
How to detect change with same value @Input() in Angular?
I have an Angular Custom scroll directive with an @Input() where I am passing an HTML element as a parameter to move the scrollbar to that specific HTML Element.
With this approach, if I pass the same HTML Element multiple times, the Input detecting…

RAHUL KUNDU
- 745
- 2
- 12
- 33
2
votes
3 answers
Child component getting data from @Input or Service Subscription? Which is better?
I have a parent component, a child component and a service. The parent component subscribes an object data from the service. The child component needs to listen for that data change too. Which is better, child component gets data from its parent…

Emmanuel Sayson
- 279
- 3
- 14
1
vote
1 answer
Why not get the value passed from the parent component to the child component correctly?
I need to pass a variable value from the parent component to the child component through an input. That is, the screenMode value received through the above ng-container needs to be given to the add-user child component.

Demodev
- 94
- 10
1
vote
1 answer
Using @Input between parent and child component via routing module in Angular
This is parent component :
parent.component.ts ==>
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-parent',
templateUrl: '
I am the parent
…
Garry14
- 41
- 9
1
vote
2 answers
How can I display the details from a parent object in a child input form with Angular Material?
I'm trying to display a object from a parent table in a child form input field with Angular Material. But it doesn't display the object values in the input fields. It only displays the that I have created. I have tried add placeholders…

Sick1Webby
- 13
- 3
1
vote
2 answers
Trigger a function once 2 inputs are set and then afterwards if either of the value changes in Angular
I have a component with 2 inputs (or mor) and I want to:
Trigger a method X the first time, when both value are set and exists
Trigger a method X each time, if either one of the both value changes

Han Che
- 8,239
- 19
- 70
- 116
1
vote
0 answers
Angular Inline-Editing Component
i'm searching an Component/Plugin/Way for inline-editing in Angular like Jira. I have recorded a sample gif Sample GIF:
Does have anybody a component like this? I will be happy to hear your suggestions:) Thanks!

fanavity
- 51
- 5