通过输出绑定 AngularJS 传递参数

Tom*_*ato 1 javascript binding angularjs typescript

我必须使用 Typescript 使用 AngularJs 1.5.8 进行以下设置:

我有一个包含目录(项目的二维数组)的父组件。从我将目录中的每个列表传递给子组件的位置:

...
export class ParentController {

    private catalog = []; //contains a list of lists

    ...

    private printCallback(item: any): void {
        console.log(item);
    }
}
Run Code Online (Sandbox Code Playgroud)

和模板:

<div ng-repeat="list in $ctrl.catalog">
    <child content="list" callback="$ctrl.printCallback(item)"></child>
</div>
Run Code Online (Sandbox Code Playgroud)

现在在子组件中,我再次遍历列表中的每个项目。每当我单击列表中的项目时,我都希望父项知道我单击的项目:

export class ChildComponent implements IComponentOptions {
template: any = require('./child.component.html');
public bindings: any = {
    content: '<',
    callback: '&'
};
controller: any = ChildController;
}

export class ChildController {

    public content: Array<any>;
    public callback;

    ...

    public onTrigger(item: any): void {
        this.callback(item);
    }
}
Run Code Online (Sandbox Code Playgroud)

和子模板:

<div ng-repeat"item in $ctrl.content">
    <button ng-click="$ctrl.onTrigger(item)">{{item.name}}</button>
</div>
Run Code Online (Sandbox Code Playgroud)

现在我似乎无法在我的父组件的printCallBack()中打印该项目。我不知道我做错了什么,因为唯一打印的是undefined。我环顾四周,找不到可行的解决方案。所以我希望你能帮助我。