我有我通過函數建立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;
}
所有樣式工作正常,除了溢出。