一步一步在angular11中添加多语言支持
摘要:1.新建angular 2.添加@angular/localize ng add @angular/localize 3.设置默认locale_id,在app.module.ts中(忽略此步) import { NgModule } from '@angular/core'; import { Br
阅读全文
posted @
2021-01-28 12:40
chen8840
阅读(895)
推荐(0)
使用Pure Pipes来替换HTML里面的纯函数
摘要:<ul *ngFor="let item of list"> <li>{{show(item.label)}}</li> </ul> 上面的代码每次变化检测的周期都会执行,即使item.label没有改变 此时应该使用Pure Pipes来代替show函数 @Pipe({ name: 'showla
阅读全文
posted @
2021-01-25 16:15
chen8840
阅读(89)
推荐(0)
使用OnPush和immutable.js来提升angular的性能
摘要:angular里面变化检测是非常频繁的发生的,如果你像下面这样写代码 <div> {{hello()}} </div> 则每次变化检测都会执行hello函数,如果hello函数十分耗时,则会出现占用CPU高的问题。 这时,推荐使用OnPush策略和immutable.js来提升angular应用的性
阅读全文
posted @
2021-01-20 17:05
chen8840
阅读(277)
推荐(0)
ExpressionChangedAfterItHasBeenCheckedError详细解释
摘要:一个angular组件,他的生命周期是这样的 update bound properties for all child components/directives call ngOnInit, OnChanges and ngDoCheck lifecycle hooks on all child
阅读全文
posted @
2021-01-14 12:01
chen8840
阅读(1804)
推荐(0)