ngFor: If a function get iterable objects, class of iterables isn't recognized

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of support-swapna support-swapna 1 week, 1 day ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #536206 Reply
    Profile photo of ber000
    ber000
    Participant

    With webclipse 1.8.3.201, when using a ngFor and a function to get iterable objects, the type/fields of iterable objects isn’t recognized. It works fine if the iterable objects are get with a field.

    // Typescript code is just for an example, doesn’t make sense. In practice a sort was applied in the function.

    export class Audit {
    constructor(
    public principal: string,
    public timestamp: string,
    public type: string
    ) { }
    }
    export class AuditsComponent {
    audits: Audit[];
    getAudits() {
    return audits;
    }
    getAuditsTyped(): Audit[] {
    return audits;
    }
    }

    Websclipse doesn’t identify audit class when getAudits() is used:
    <tr *ngFor=”let audit of getAudits()”>
    <td>{{audit.type}}</td>
    </tr>

    Websclipse doesn’t identify audit class when getAuditsTyped() is used:
    <tr *ngFor=”let audit of getAuditsTyped()”>
    <td>{{audit.type}}</td>
    </tr>

    Websclipse identifies well audit class when a field is used instead of a function:
    <tr *ngFor=”let audit of audits”>
    <td>{{audit.type}}</td>
    </tr>

    #536376 Reply
    Profile photo of support-swapna
    support-swapna
    Moderator

    ber000,

    Thank you for the example code. I could replicate the validation problem when using the function in ngFor.
    The dev team is looking into it. We will keep you posted when the fix is out.

    Thank you for reporting it.

    –Swapna
    MyEclipse Support

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: ngFor: If a function get iterable objects, class of iterables isn't recognized