我有我通过函数建立ngStyle一个组成部分,它的工作原理所有样式除溢出-Y,我不知道它实际上是设置本身以及任何想法?集ngStyle使用Angular2
onChangeFilterClientes(obj:any):any[]{
return this.clientes.filter(c => c.Nombre.toString().toLowerCase().indexOf(obj.query)>-1);
}
我的组件上的功能:
interface IOpcionesListaAutocomplete {
width: number;
height: number;
isOverflowY: boolean;
}
export class OpcionesListaAutocomplete implements IOpcionesListaAutocomplete {
width: number;
height: number;
isOverflowY: boolean;
constructor() { }
}
@Input()
opcionesLista: IOpcionesListaAutocomplete = {
width: 550,
height: 150,
isOverflowY: true
};
addStylesLista(){
let styles= {
'heigth.px':this.opcionesLista.height,
'width.px':this.opcionesLista.width,
'overflow-y': this.opcionesLista.isOverflowY? 'auto': 'hidden'
};
return styles;
}
所有样式工作正常,除了溢出。