ngFor directive working, Commonmodule declared correctly, but the editor flags the module declaration error

Asked

Viewed 14 times

0

I am using the *ngFor directive to display the result of an array within a component, the structure is working correctly, however, in the editor (Visual Studio Code), it signals the following error:

Property binding ngForOf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations".

Below is the code of the view Dashboard.component.html:

<ul>
    <li *ngFor="let item of vetor">
        {{item}}
    </li>
</ul>

below the module that the component is part of (view.module.ts), having the Commonmodule declared:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { DashboardComponent } from '@src/app/views/dashboard/dashboard.component';
import { SharedModule } from '../shared/shared.module';

@NgModule({
  declarations: [DashboardComponent],
  imports: [
    SharedModule,
    CommonModule,
  ]
})
export class ViewsModule { }

Below the image of the Vscode editor signaling the error: inserir a descrição da imagem aqui

Although the code runs properly returned the expected values, this Vscode signaling bothers, because I do not know if it is a real signaling, or some configuration of the editor. How to identify the fault?

Below the data of ng --version:

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 8.3.29
Node: 14.17.0
OS: darwin x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.29
@angular-devkit/build-angular     0.803.29
@angular-devkit/build-optimizer   0.803.29
@angular-devkit/build-webpack     0.803.29
@angular-devkit/core              8.3.29
@angular-devkit/schematics        8.3.29
@angular/cli                      8.3.29
@ngtools/webpack                  8.3.29
@schematics/angular               8.3.29
@schematics/update                0.803.29
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

The option to use an older version of Angular is due to the project being using Nativescript with code sharing (web and mobile).

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.