角度:当组件发生变化时,如何提供视觉/UI 提示?



另一个 Angular 新手挑战...

假设我有一个应用程序显示AAPL股票的最新价格。我有一个传递此价格的组件。每次查询 API 时,我都会得到一个新价格并将其传递给组件。

问题:

我想给盯着应用程序的用户一些视觉反馈。假设我想在刚刚更新的价格上快速闪烁一些背景色,并将其优雅地淡出。

我该如何实现这一点?

提前感谢任何可能的解决方案!

简单的实现

//Component
@Component({
selector: 'app-list'
})
export class ListComponent {
private color: string;
apiGet(){
this.color = ""//Get color from API
}
getColor(): string {
return this.color;
}
}
Template
<div style='background-color:{{getColor()}}'>List</div>

希望对:)有所帮助

在这里找到解决方案:

角度 5 动画:递增和递减

https://medium.com/xp-inc/angular-5-animations-increment-and-decrement-12bb6aa992eb?

最新更新