lundi 14 juin 2021

How to handle message IF ELSE if it too long

I've no idea how to figure out the best method to handle this message to display if it too long. I've try to put IF ELSE in another page but I don't know how to call it. Example code like bellow:-

ts file

private getQuotCollection(id: number) {

    this._spin.show();
    this._user.getApi(this.quotCollectionURL + id).subscribe(
      (res) => {
        this._spin.hide();
        if (res.status.code === 0) {

          this.respCode = this.quoteCollection?.respCode;

          if (this.respCode == 'v001') {
            this.respDesc = this.translate.instant('code_001');
          }else if (this.respCode == 'v002') {
            this.respDesc = this.translate.instant('code_002');
          }else if (this.respCode == 'v003') {
            this.respDesc = this.translate.instant('code_003');
          }else if (this.respCode == 'v004') {
            this.respDesc = this.translate.instant('code_004');
          }else if (this.respCode == 'v005') {
            this.respDesc = this.translate.instant('code_005');
          }else if (this.respCode == 'v006') {
            this.respDesc = this.translate.instant('code_006');
          }else if (this.respCode == 'v007') {
            this.respDesc = this.translate.instant('code_007');
          }else if (this.respCode == 'v008') {
            this.respDesc = this.translate.instant('code_008');
          }else if (this.respCode == 'v009') {
            this.respDesc = this.translate.instant('code_009');
          }else if (this.respCode == 'v010') {
            this.respDesc = this.translate.instant('code_010');
          } and so on till 'v200'{

Aucun commentaire:

Enregistrer un commentaire