File

src/app/modules/shared/components/no-result/no-result.component.ts

Description

No Result component

Implements

OnInit OnDestroy

Metadata

Index

Properties
Methods
Inputs

Constructor

constructor(resourceService: ResourceService)
Parameters :
Name Type Optional
resourceService ResourceService No

Inputs

data
Type : INoResultMessage

input for NoResultMessage

Methods

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

Properties

message
Type : string

no result message

messageText
Type : string

no result messageText for component

resourceDataSubscription
Type : Subscription
Public resourceService
Type : ResourceService
Public unsubscribe$
Default value : new Subject<void>()
import { Component, OnInit, Input, OnDestroy } from '@angular/core';
import {INoResultMessage} from '../../interfaces/noresult';
import { ResourceService } from '../../services/index';
import { Subscription, Subject } from 'rxjs';
import * as _ from 'lodash-es';
import { takeUntil } from 'rxjs/operators';



/**
 * No Result component
 */
@Component({
  selector: 'app-no-result',
  templateUrl: './no-result.component.html',
  styleUrls: ['./no-result.component.scss']
})
export class NoResultComponent implements OnInit, OnDestroy {
  /**
   * input for NoResultMessage
  */
  @Input() data: INoResultMessage;
  /**
   * no result message
  */
  message: string;

  resourceDataSubscription: Subscription;
  /**
   * no result messageText for component
  */
  messageText: string;
  public unsubscribe$ = new Subject<void>();

  constructor(public resourceService: ResourceService) { }

  ngOnInit() {
    this.setMessage();
    this.resourceDataSubscription = this.resourceService.languageSelected$
    .pipe(takeUntil(this.unsubscribe$)).subscribe(data => {
      this.setMessage();
    }, err => {
    });
  }

  setMessage() {
    this.message = _.has(this.data, 'message') ? (_.get(this.resourceService, this.data.message) ||
    _.get(this.resourceService, 'messages.stmsg.m0007')) : '';

    this.messageText = _.has(this.data, 'messageText') ? (_.get(this.resourceService, this.data.messageText) ||
      _.get(this.resourceService, 'messages.stmsg.m0006')) : '';
  }

  ngOnDestroy() {
    this.unsubscribe$.next();
    this.unsubscribe$.complete();
    if (this.resourceDataSubscription) {
      this.resourceDataSubscription.unsubscribe();
    }
  }
}
<div class="ui grid">
    <div class="one wide column"></div>
    <div class="ten wide column">
        <div class="ui two column centered grid no-result-container">
            <div class="d-flex flex-dc flex-jc-center flex-ai-center column">
                <img alt="{{messageText}}" src="{{'assets/images/erroricon.png' | cdnprefixurl}}">
                <div class="mt-16 no-result-text">{{messageText}}</div>
                <!-- <div ng-if="messageText" class="no-result-search-text">{{message}}</div> -->
                <ng-content></ng-content>
            </div>
        </div>
    </div>
    <div class="one wide column"></div>
</div>

./no-result.component.scss


Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""