File

src/app/modules/badging/components/content-badge/content-badge.component.ts

Implements

OnInit OnDestroy

Metadata

Index

Properties
Methods
Inputs

Constructor

constructor(contentBadgeService: ContentBadgeService)
Parameters :
Name Type Optional
contentBadgeService ContentBadgeService No

Inputs

data
Type : Array<object>

Methods

ngOnDestroy
ngOnDestroy()
Returns : void
ngOnInit
ngOnInit()
Returns : void

Properties

Public contentBadgeService
Type : ContentBadgeService
Public unsubscribe
Default value : new Subject<void>()
import {takeUntil} from 'rxjs/operators';
import {  Subject } from 'rxjs';
import { Component, OnInit, Input, OnDestroy } from '@angular/core';
import { ContentBadgeService } from './../../services';
@Component({
  selector: 'app-content-badge',
  templateUrl: './content-badge.component.html'
})
export class ContentBadgeComponent implements OnInit, OnDestroy {
  @Input() data: Array<object>;
  public unsubscribe = new Subject<void>();
  constructor(public contentBadgeService: ContentBadgeService) { }

  ngOnInit() {
    this.contentBadgeService.badges.pipe(
      takeUntil(this.unsubscribe))
      .subscribe((data) => {
        if (this.data === undefined) {
          this.data = [];
        }
        this.data.push(data);
    });
  }
  ngOnDestroy() {
    this.unsubscribe.next();
    this.unsubscribe.complete();
  }
}
<div class="ui grid padded" *ngIf="data && data.length > 0">
  <div class="twelve wide column p-0">
    <div class="mr-8 d-inline-block" *ngFor="let selectedbadge of data">
      <img 
        *ngIf="selectedbadge.badgeClassImage || selectedbadge.name" 
        class="ui mini image" 
        src="{{selectedbadge.badgeClassImage ||selectedbadge.image}}"
        alt="{{selectedbadge.badgeClassName || selectedbadge.name}}"
        matTooltip="{{selectedbadge.badgeClassName || selectedbadge.name | uppercase}}" [matTooltipPosition]="'above'" 
      />
    </div>
  </div>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""