fix(bundles): simplify features block

This commit is contained in:
Dmitry Nehaychik 2019-02-06 11:47:51 +03:00
parent 0949ecc67c
commit 9fc42b19c0
5 changed files with 20 additions and 38 deletions

View file

@ -2,7 +2,7 @@
<ngx-landing-main-info></ngx-landing-main-info>
</div>
<ngx-landing-description-section *ngIf="descriptions" [descriptions]="descriptions" ></ngx-landing-description-section>
<ngx-landing-description-section *ngIf="descriptions | async" [descriptions]="descriptions | async" ></ngx-landing-description-section>
<ngx-landing-theme-section></ngx-landing-theme-section>

View file

@ -4,27 +4,18 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
import { Component, OnDestroy } from '@angular/core';
import { Component } from '@angular/core';
import { Observable } from 'rxjs';
import { Descriptions, DescriptionsService } from '../../../@core/data/service/descriptions.service';
import { takeWhile } from 'rxjs/operators';
@Component({
selector: 'ngx-landing-sections-container',
templateUrl: './ngx-landing-sections-container.component.html',
styleUrls: ['./ngx-landing-sections-container.component.scss'],
})
export class NgxLandingSectionsContainerComponent implements OnDestroy {
export class NgxLandingSectionsContainerComponent {
private alive = true;
descriptions: Descriptions[];
descriptions: Observable<Descriptions[]> = this.descriptionsService.getDescriptions();
constructor(private descriptionsService: DescriptionsService) {
this.descriptionsService.getDescriptions()
.pipe(takeWhile(() => this.alive))
.subscribe((descriptions) => this.descriptions = descriptions);
}
ngOnDestroy() {
this.alive = false;
}
constructor(private descriptionsService: DescriptionsService) { }
}