0
votes

I get this error when trying to paint a class in the html

<li>
    <ul>
      <li *ngFor="let refac of refactormodel" >
        -- word_to_rename: {{refac.word_to_rename}}
        -- renowned_word: {{refac.renowned_word}}
         -- name: {{refac.name}}
      </li>
    </ul>     
  </li>

I want that if the class is empty I do not paint it, but yes, and when painting it gives that error: ERROR Error: Error trying to diff 'nombreyo'. Only arrays and iterables are allowed

private refactormodel : getrefactormodel[] = [];

....

this.authService.getrefactor().subscribe((res : getrefactormodel[])=>{
        this.refactormodel = res;
      });

 getrefactor() {
          return this.http.get(apiUrl + 'getRules');
         
      } 

refactormodel.ts:

export interface getrefactormodel {
      word_to_rename: String;
      renowned_word: String;
      name: String;

    }
1

1 Answers

0
votes

Have you tried it like this already?:

  <li *ngFor="let refac of refactormodel" >{{ '-- word_to_rename' + refac.word_to_rename + '...further text fragments...' }}
  </li>