I'm newbie in angular. So possibly I just missed smth important because of lack of experience. Please, help me to access child component from parent.
app.module.ts
import { FilePickerComponent } from "src/app/common/file-picker/file-picker.component";
...
@NgModule({
declarations: [
FilePickerComponent,
...
]})
export class AppModule {}
file-picker.component.ts
...
@Component({
selector: "app-file-picker",
templateUrl: "./file-picker.component.html",
styleUrls: ["./file-picker.component.css"],
})
...
editor.html
<form>
...
<app-file-picker
placeholder="Image"
required>
</app-file-picker>
...
</form>
editor.ts
import {
Component,
OnInit,
ViewChild,
OnDestroy
} from "@angular/core";
import { FilePickerComponent } from "src/app/common/file-picker/file-picker.component";
export class Editor implements OnInit, OnDestroy {
@ViewChild(FilePickerComponent) filePicker!: FilePickerComponent;
async save() {
}
at the moment when I try to access file picker from save it is undefined. how can I access file picker component from editor.ts?