2016-02-22 21 views
0

我有以下情形:绑定到@input上延长部件的工作不

export class ComponentA 
{ 
    @Input model 
} 

@Component({ 
template: 
` 
    <h5>{{model.name}}</h3> 
` 
}) 

export class ComponentB extends ComponentA 
{ 
    @Output changed = new EventEmitter(); 
} 

@Component({ 
    template: 
    ` 
    <component-b [model]="myModel"> </component-b> 
    ` 
    }) 

    export class ComponentC{ 

    public myModel:any = {name:'bla'} 
    } 

到模型的结合是行不通的。 但是,如果我将删除@Output成员它将工作!

有什么建议吗?

回答

1

似乎是由@Input() s没有继承的设计。请参阅https://github.com/angular/angular/issues/5794

+0

这将是非常好的,如果他们虽然.. :) – PierreDuc

+0

谢谢! 我想,当我删除输出,然后输入继承工程是一个BUG? 你能理解我们为什么不能继承@Inputs吗? – almog

+0

我只记得看到这个问题,当我看到你的问题时就会看到它。这个问题并未结束,因此可能仍然考虑实施它。我参与了关于Dart的关于继承'implements OnInit'的类似讨论(在Dart中'implements SomeLifcycleInterface'是强制性的)。目前它们不会支持它,因为它在使用当前构建基础结构构建大型应用程序时会导致性能问题。他们肯定希望支持继承生命周期接口实现。这可能是因为@ Input()现在不起作用。 –