У меня есть настройка родительского и дочернего компонентов, когда при (касании) события на элементе в дочернем элементе мне нужно вызвать родительский метод. Я пытаюсь EventEmmiter, но получаю эту ошибку:
Ошибка: com.tns.NativeScriptException: не удалось найти модуль: «события»,
относительно: app / tns_modules /
Фрагмент кода
Parent.component.html
<app-header (thisEvent)="navigate($event)"></app-header>
Parent.component.ts
import { Component } from "@angular/core";
@Component({
moduleId: module.id,
selector: "app-main",
templateUrl: "./parent.component.html",
styleUrls: ["./parent.component.css"]
})
export class ParentComponent {
naviagte(args){
this.router.navigate(["/"]);
}
}
Child.component.html:
<Button text="Tap" class="btn btn-primary" (tap)="onTap($event)"></label>
Child.component.ts:
import { Component, Input, Output } from "@angular/core";
import { EventEmitter } from "events";
@Component({
selector: "app-header",
moduleId: module.id,
templateUrl: "./child.component.html",
styleUrls: ["./child.component.css"]
})
export class ChildComponent {
@Output()
thisEvent= new EventEmitter();
navigate(args) {
this.thisEvent.emit(null);
}
}