ngoninit Questions

25

Solved

I trying to create new component, ResultComponent, but its ngOnInit() method is getting called twice and I don't know why this is happening. In the code, ResultComponent inherits @Input from the pa...
Strategy asked 5/8, 2016 at 11:10

16

Solved

I am calling router.navigate on same page with some query string parameters. In this case, ngOnInit() does not call. Is it by default or do I need to add anything else ?
Anurag asked 16/1, 2017 at 14:12

2

I would like to get rid of the Error above. It started to appear after re-installed dependencies using npm i. I tried removing "implements onInit" and it disappeared So the problem is rel...
Emmalineemmalyn asked 30/8, 2022 at 19:44

27

Solved

Angular provides life cycle hook ngOnInit by default. Why should ngOnInit be used, if we already have a constructor?
Yance asked 3/3, 2016 at 5:14

3

Solved

On my Angular 10 app, I'm loading through the component factory resolver a component containing an AG Grid. When I trigger the factory resolver through a button, everything works fine. The Grid is ...
Premise asked 10/11, 2020 at 15:13

2

I know this is posted all over SO and the internet but I'm reading so many different things, I'm just a little confused now. 2 QUESTIONS - Where is the best place to subscribe to my componen...
Facetious asked 10/10, 2020 at 19:38

8

I have 3 tabs in which one tab shows a table with list of employees. Works good when it is loaded the first time.ngOnInit Fetches data from server using http get. After that when I click add new em...
Housewifely asked 2/6, 2017 at 13:19

2

Solved

I'm running two MatTables in different components with data sources from different observables. One of my tables sort functionality is working fine and but on my second table it seems as if the @Vi...

5

Solved

Angular provides lifecycle hook ngOnInit() and ngOnChanges() by default. Why should ngOnInit be used, if we already have a ngOnChanges? And constructor also.
Argentic asked 8/6, 2018 at 4:59

1

Maybe the answer to this question is relevant for AngularJS (1.x) also, but my question here is for Angular 2 and above. As we know, every component file has its own ngOnInit function, which runs ...
Literally asked 8/5, 2018 at 12:50

1

Solved

first, make table setting data in ngOnInit() and set to settingA variable. this settingA variable binds to setting in html. and I want to make table in child component using settingA. but child ...
Sarcous asked 21/2, 2018 at 16:43

1

Solved

I am trying to add a custom validator to an input, but when I do so it triggers an ExpressionChangedAfterItHasBeenCheckedError error saying something changed from TRUE to FALSE. I traced the probl...
Callisto asked 7/9, 2017 at 16:30

3

I can not understand what the difference between ngOnInit and ngAfterViewInit. I found the only difference between them is @ViewChild. According to the following code, the elementRef.nativeElement ...
Pleasing asked 26/11, 2016 at 10:27

2

Solved

I'm having a very odd issue with Angular 2 routing to where my ngOnInit in the component that I am routing to is getting called twice, and the route in the browser is getting reset to the original ...
Spiv asked 9/3, 2017 at 16:8

1

Solved

Right now I'm making a kind of web shop, and on my home page I've a dropdown of category Let say parent cat A, and sub cats B and C. Cat A, B and C are all represented by 1 component, CatAComponen...
Neustria asked 23/12, 2016 at 11:38

2

Solved

I'm writing an angular2 application and I'm stuck with something. First of all, I have a select which is bind to a formControl : export class MyComponent implements OnInit { profilesBy: Observabl...

1

Solved

If I call a function in ngOnInit() that makes an observable call to get data, is the this.getSomething() call in ngOnInit still async or does ngOnInit wait until this.getSomething() returns a resul...
Nedra asked 14/9, 2016 at 13:42

1

Solved

I am building an Angular 2 app with version beta.8. In this app i have a component which implements OnInit. In this component i have the function ngOnInit, but the ngOnInit function is never called...
Prognathous asked 11/3, 2016 at 9:32

3

Solved

If I want function x to happen every time a component loads, whether its the first time, I navigate to a different site and navigate back or it's the fifth time the component has loaded. Wha...
Spellman asked 7/3, 2016 at 13:53
1

© 2022 - 2024 — McMap. All rights reserved.