Questions tagged [ngonchanges]

Respond when Angular (re)sets data-bound input properties. The method receives a SimpleChanges object of current and previous property values. Called before ngOnInit and whenever one or more data-bound input properties change.

123 questions
1
vote
0 answers

Angular 2 Input type File, ngOnChanges is not performed

I created a custom component and applied it on [ERR] is created to show error, but hook event of that component ngOnChanges is not performing on…
mukund patel
  • 1,039
  • 10
  • 31
1
vote
1 answer

Angular 4 - formcontrol.setValue() inside OnChanges()

Using Angular 4. I have a paging.component that gets the page number and pageSize from it's parent component (after it gets data). The paging.component will look for changes to the @Input's using the OnChanges life-cycle hook. The paging.component…
1
vote
2 answers

ngx-chart: Show live data, angular 4.3

i want to visualize some live data in the ngx-chart-gauge. I build this up with this demo: https://swimlane.gitbooks.io/ngx-charts/content/v/6.0.2/charts/gauge.html I get my livedata from a Service and want to show the data in the ngx-chart-gauge.…
Steffn
  • 275
  • 1
  • 6
  • 21
1
vote
0 answers

How to refresh component on update to @Input properites

I am trying to refresh an angular component whenever I update the components @Input property using ngOnChanges() method but it is not working. Scenario is as below: I have an component called all-tasks.component whose template is defined as…
svijay.aug12
  • 531
  • 3
  • 13
  • 32
1
vote
4 answers

ngOnChanges working only when there is an action

I create my own upload file component using XMLHttpRequest and everything works fine... The only issue that I have is that I create a callback method which update the progress of the upload so the user can see the percentage. If I do a consolo.log()…
Faabass
  • 1,394
  • 8
  • 29
  • 58
1
vote
1 answer

Angular - ExpressionChangedAfterItHasBeenCheckedError on binding

I have one field and one component which have a common model binded. I'm using ngOnChanges() in the component to check the value of that input, and also I'm changing the model binded to that input somewhere in this component. Let say we…
Bünyamin Sarıgül
  • 3,031
  • 4
  • 30
  • 55
1
vote
1 answer

Does array change to an object after @Input() into child?

I'm quite new to Angular 2 and I would like to transfer an array made in a parent component, via @Input(), to its child. In the parent I create the array, add data from a service, and display it in the console (Console output 1). In the child…
Merlin
  • 43
  • 1
  • 5
1
vote
1 answer

Angular 2 two-way component binding doesn't call parent ngOnChange

I have created a plunker here: http://plnkr.co/edit/8bwqkYQ6tqrpGwHT588y?p=preview that shows the issue. Basically, I have 2 components. The first component has a 2-way binding of a property to the child component. My parent component is: import…
Scottie
  • 11,050
  • 19
  • 68
  • 109
0
votes
0 answers

Modification of primitive values from @Input() object in child component Angular

I want to modify the @Input() object values in child component after every change in parent component. Please find the sample example In below example, I increment the counter from parent component and passing complete object to child component.…
0
votes
0 answers

How to trigger ngOnChanges to update my formgroup

My parent component subscribes to param changes: this.route.queryParamMap.pipe(take(1)).subscribe(params => { const changedQueryParams = {}; params.keys.forEach((key) => { const values = params.getAll(key); if…
0
votes
1 answer

ngOnchanges() not getting called, once we set input property from parent in the child component manually

Even though the doc mentions - A lifecycle hook that is called when any data-bound property of a directive changes. Just want to know why change detection using ngOnchanges() doesn't work when we manually change the color property received from the…
0
votes
2 answers

How do I push an object data into the array in the child component on @Input change?

sorry I am a beginner, what I am trying to do is pass an object from a parent component to a child component, which I successfully did by using @Input decorator, in this case the object is 'productCarted'. Next, I want to push that data object into…
shahiedul
  • 41
  • 4
0
votes
0 answers

refresh angular view changesDetectorRef.markForCheck

I am presenting a difficulty to update the view of a form. in the onInit I define it and the objective is that after with the response of the API update the data of the form and the view, when clicking on the button that activates the toggleDetails…
0
votes
0 answers

component and directive have same life cycle hook

Directive has same lifecycle hook when to use these lifecyclehook in live environment. if directive don't have View .then where we use lifecyclehook
Ram
  • 1
  • 1
0
votes
2 answers

Angular2 ngOnChanges not firing when input is array

I'm using a ParentComponent that sets inputs to a ChildComponent. If the changed input is number, the ngOnChanges hook fires, but if it's an array, it does not. Can someone tell me what am I doing wrong, or how to make ngOnChanges firing when the…
1 2 3
8 9