docs: use const in dynamic-component-loader example (#30888)
Use const instead of let. Some of the variables are never reassigned, so it is preferred to use const over let PR Close #30888
This commit is contained in:
parent
c15e6750d5
commit
bb635c09fd
|
@ -36,14 +36,14 @@ export class AdBannerComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
loadComponent() {
|
loadComponent() {
|
||||||
this.currentAdIndex = (this.currentAdIndex + 1) % this.ads.length;
|
this.currentAdIndex = (this.currentAdIndex + 1) % this.ads.length;
|
||||||
let adItem = this.ads[this.currentAdIndex];
|
const adItem = this.ads[this.currentAdIndex];
|
||||||
|
|
||||||
let componentFactory = this.componentFactoryResolver.resolveComponentFactory(adItem.component);
|
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(adItem.component);
|
||||||
|
|
||||||
let viewContainerRef = this.adHost.viewContainerRef;
|
const viewContainerRef = this.adHost.viewContainerRef;
|
||||||
viewContainerRef.clear();
|
viewContainerRef.clear();
|
||||||
|
|
||||||
let componentRef = viewContainerRef.createComponent(componentFactory);
|
const componentRef = viewContainerRef.createComponent(componentFactory);
|
||||||
(<AdComponent>componentRef.instance).data = adItem.data;
|
(<AdComponent>componentRef.instance).data = adItem.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue