且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ES5中的Angular2输出?

更新时间:2023-09-23 23:13:10

您需要像这样更改代码:

You need to change your code like this:

var SampleComponent10 = ng.core.Component({
    selector: "sampleten",
    outputs: ["click"],
    template: ""
}).Class({
    constructor: function(){
        this.click = new ng.core.EventEmitter(); <== add this line
        setInterval(function(){
            this.click.next({});
        }.bind(this), 10000)
    }
})

另请参见 https://angular.io/docs/ts/latest/cookbook/ts-to-js.html#!#property-metadata