facebook

codemix shows errors for fields of FormGroup in html

  1. CodeMix & Angular IDE
  2.  > 
  3. Getting Help
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #631424 Reply

    MuhammedShakir
    Participant

    in my component html file, I get errors for registrationForm.controls.username where in registrationForm is the FormGroup object. It says “identifier username is not defined. __type does not contain such a member”. Please help

    #631425 Reply

    support-swapna
    Moderator

    Muhammed,

    This looks like a code related issue.
    Can you please check these threads discussing similar issue and see if any of the suggestions help?
    https://github.com/angular/vscode-ng-language-service/issues/152
    https://stackoverflow.com/questions/47466324/identifier-required-is-not-defined-type-does-not-contain-such-a-member

    If you are still seeing problems, please share with us the sample project (zipped project) exhibiting the error to help us replicate the problem at our end.

    Hope this helps.

    –Swapna
    Genuitec Support

    #631506 Reply

    MuhammedShakir
    Participant

    Hi Swapna,

    Note that the code works like a charm without any errors. It is just that the IDE shows the error. Upon execution it executes as expected. However, when prepended with !! the error goes off

    #631555 Reply

    support-swapna
    Moderator

    Muhammed,

    Glad that the workaround helps. We will look into it.
    Please let us know if you see any other issues.

    –Swapna
    Genuitec Support

    #632372 Reply

    John
    Participant

    In some case the error will go off. For example:

    Component:

    class NotificationBase {
      version: number = 0;
      timeCreated = Date.now();
      priority: NotePriority = NotePriority.NORMAL;
      body?: any;
    }
    
    public notifications: NotificationBase[] = [];
    

    HTML

    <li *ngFor="let alert of notifications | slice:(page-1)*limit:page*limit; let i = index">
      <a href="javascript:;" class="dropdown-item mg-dropdown-item"
        (mouseover)="toggleShowX(true, i)" (mouseleave)="toggleShowX(false, i)"
        (click)="openAlert(alert, i)">
        <span class="mg-nf-alert">
          <span class="mg-nf-alert-head"
            [class.mg-nf-low]="alert.priority === 1"
            [class.mg-nf-normal]="alert.priority === 2"
            [class.mg-nf-high]="alert.priority === 3"
            [class.mg-nf-critical]="alert.priority === 4">
            {{!!alert.body.header}}
          </span>
          <span *ngIf="!!alert.body.badge" class="mg-nf-label">
            {{!!alert.body.badge}}
          </span>
          <span (click)="dismiss(alert, i)" class="mg-nf-close"
            [class.mg-nf-close-show]="showClose[i] && alert.body.dismiss">
            <i class="fa fa-times-circle"></i>
          </span>
        </span>
        <span class="mg-nf-time">
          {{timePassed(!!alert.timeCreated)}}
        </span>
      </a>
    </li>

    In the above code i see the following errors which do not go away with !! when the line is

    • [class.mg-nf-normal]=”alert.priority === 2″

    However, I can make the error go away on *ngIf and embedded {{variable}}.

    Definitely a problem.

    #632898 Reply

    John
    Participant

    An update here. The !! before your variable does not provide even a partial fix. It seems that most objects with properties show as errors when referenced from html. They do work correctly.

    #633004 Reply

    support-swapna
    Moderator

    John,

    Apologies for the delayed response. We are looking into the reported issues.
    We will keep you posted about our findings soon.

    Sorry for inconvenience caused.

    –Swapna
    Genuitec Support

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: codemix shows errors for fields of FormGroup in html

You must be logged in to post in the forum log in