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:
Bo Vandersteene 2019-06-06 09:23:31 +02:00 committed by Andrew Kushnir
parent c15e6750d5
commit bb635c09fd
1 changed files with 4 additions and 4 deletions

View File

@ -36,14 +36,14 @@ export class AdBannerComponent implements OnInit, OnDestroy {
loadComponent() {
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();
let componentRef = viewContainerRef.createComponent(componentFactory);
const componentRef = viewContainerRef.createComponent(componentFactory);
(<AdComponent>componentRef.instance).data = adItem.data;
}