-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Closed
Milestone
Description
Short description of the problem:
ionViewDidLoad fires before childs components have been loaded.
What behavior are you expecting?
ionViewDidLoad fires after childs components have been loaded, so I can access it's properties that are loaded in ngOnInit
Steps to reproduce:
1.
2.
3.
export class DynamicForm implements OnInit {
@ViewChild(DynamicForm) dform: DynamicForm
ngAfterViewInit() {
console.debug("[HomePage]: ngAfterViewInit");
console.debug("\t this.dform", this.dform)
console.debug("\t this.dform.form", this.dform.form)
console.debug("#####################");
}
ionViewDidLoad() {
console.debug("[HomePage]: ionViewDidLoad");
console.debug("\t this.dform",this.dform)
console.debug("\t this.dform.form", this.dform.form)
console.debug("#####################");
}
}
export class DynamicForm implements OnInit {
public form: FormGroup;
ionViewLoaded() {
//do not fire
console.debug("[DynamicForm]: ionViewLoaded")
this.form = this.qcs.toFormGroup(this.groups_questions);
console.debug("\t", this.form);
console.debug("#####################");
}
ngOnInit() {
console.debug("[DynamicForm]: ngOnInit")
this.form = this.qcs.toFormGroup(this.groups_questions);
console.debug("\t", this.form);
console.debug("#####################");
}
}
console output
[HomePage]: ionViewDidLoad
this.dform DynamicForm {qcs: QuestionControlService, groups_questions: Array[0], submitEvent: EventEmitter, cancelEvent: EventEmitter}
this.dform.form undefined
#####################
[DynamicForm]: ngOnInit
FormGroup {validator: null, asyncValidator: null, _pristine: true, _touched: false, _onDisabledChange: Array[0]…}
#####################
[HomePage]: ngAfterViewInit
this.dform DynamicForm {qcs: QuestionControlService, groups_questions: Array[5], submitEvent: EventEmitter, cancelEvent: EventEmitter, form: FormGroup}
this.dform.form FormGroup {validator: null, asyncValidator: null, _pristine: true, _touched: false, _onDisabledChange: Array[0]…}
#####################
Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)
Which Ionic Version? 1.x or 2.x
2 RC.0
Run ionic info from terminal/cmd prompt: (paste output below)
Your system information:
Cordova CLI: 6.3.1
Gulp version: CLI version 3.9.1
Gulp local:
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
OS: Distributor ID: Debian Description: Debian GNU/Linux 8.6 (jessie)
Node Version: v4.5.0
Metadata
Metadata
Assignees
Labels
No labels