管道+;带ES5的Angular 2中的指令:在构造函数上找不到指令注释

管道+;带ES5的Angular 2中的指令:在构造函数上找不到指令注释,angular,Angular,我有一个非常简单的管道: app.DisplayKeystrokePipe = ng.core .Pipe({ name: "displayKeystroke" }) .Class({ transform: function() { } }); 以及更复杂的组件/指令: app.DropDownCmp = ng.core .Component({ selector: "dropdown",

我有一个非常简单的管道:

app.DisplayKeystrokePipe = ng.core
    .Pipe({
        name: "displayKeystroke"
    })
    .Class({
        transform: function() {

        }
    });
以及更复杂的组件/指令:

app.DropDownCmp = ng.core
    .Component({
        selector: "dropdown",
        templateUrl: "dropdown.html",
        inputs: [
            'list',
            'selected'
        ],
        outputs: [
            'selectedChange'
        ]
    })
    .Class({
        constructor: function() {
            this.selectedChange = new ng.core.EventEmitter();
            this.display = "Hello";
            this.onClickHandler = function(event) {
                if(this.listVisible && !$(event.target).is(".dropdown-display") && !$(event.target).parents(".dropdown-display").length > 0) {
                    this.listVisible = false;
                }
            }.bind(this);
        },
        isSelected: function(id) {
            return id == this.selected;
        },
        show: function() {
            this.listVisible = true;
        },
        select: function(id) {
            this.selected = id;
            this.selectedChange.next(id);
        },
        ngOnInit: function() {
            document.addEventListener('click', this.onClickHandler)
        },
        ngOnDestroy: function() {
            document.removeEventListener('click', this.onClickHandler);
        },
        ngOnChanges: function(changes) {
            this.display = this.list[this.selected];
        },
    });
现在,我尝试在一个模板中使用这两种功能:

app.SomeComponent = ng.core
    .Component({
        template: `<dropdown [list]="someList" [(selected)]="currentEntry"></dropdown><br>{{1 | displayKeystroke}}`,
        directives: [app.DropDownCmp],
        pipes: [app.DisplayKeystrokePipe]
    })
    .Class({
        constructor: [ng.router.RouteData, app.LinkService, function(rd, service) {
            service.setPath(rd.data.catName, rd.data.name);
            this.someList = ['Entry1', 'Entry2', 'Entry3'];
            this.currentEntry = 0;
        }]
    });
仅使用管道时相同:

template: `{{1 | displayKeystroke}}`
只有当我同时使用两者时,才会出现此错误

我做错了什么


编辑:Plunker:

我想我找到了问题所在,在你的管道中,你有这条管线

constructor: function constructor() {}
这条线让它失败了,怎么失败,为什么失败?遗憾的是,我不能肯定。但是如果您更改它以匹配类名,或者简单地使用
function(){}
就可以了

app.DisplayKeystrokePipe=ng.core.Pipe({
名称:“显示击键”
}).类({
//匹配类名
构造函数:函数DisplayKeystrokePipe(){},
//或者简单地使用function(){}
//构造函数:函数(){},
转换:函数(){
返回“已发射”;
}
});
奇怪的是,同样具有
constructor:function constructor(){}
的指令没有出现这种情况。因此,我只需坚持使用
constructor:function(){}
,以避免出现问题


这是您的工作。

我没有您的所有代码,因此我在此将其减少到最小,并且工作正常。使用相同的plnkr,分叉,然后在可以重现错误时共享。我看到了问题所在。我从未编写过
函数构造函数(){}
,但Babelify为我做了这件事。我不知道为什么。使用
函数DisplayKeystrokePipe(){},
甚至可以通过babelification来工作,谢谢!哦,看那个!谢谢你关于巴贝尔的提示(我不使用它,但知道它很有用)。不客气,谢谢你!
constructor: function constructor() {}