在Angular 2中,我想將某個絕對定位元素設置爲某個運行時值(只要數據填充完畢)。我怎麼做 ?我可以更改代碼中的狀態設置嗎? (?或一些回調)在Angular 2.我如何動畫到某個運行時值?
@Component({
animations: [
trigger('blahState', [
state ('closed', style({ top: '0px'})),
state ('open', style({ top: ??? (<= must be the position of some dom element) })),
transition('closed => open', animate('500ms ease-in'))])
]
})
你是什麼意思'必須是某個dom元素的位置? – micronyks
頁面中HTML元素的y位置。例如offsetTop。這個位置是由數據改變..
的位置,然後怎麼樣#myElement? – micronyks