0

working with Angular app with Laravel api. I have following html file as well,

<tbody>
        <tr *ngFor="let emp of employees">
            <th scope="row">{{emp.id}}</th>
            <td>{{emp.name}}</td>
            <td>{{emp.email}}</td>
            <td>{{emp.salary}}</td>

            
        </tr>
    </tbody>

but I cant display my table data according to the html. and console generate following error message core.js:10105 NG0303: Can't bind to 'ngForOf' since it isn't a known property of 'tr'.

how could I fix this problem?

1 Answer 1

1

Make sure that you are importing the @angular/common module into your feature module. i.e. import { CommonModule } from '@angular/common'; then list the common module in the imports array

@NgModule({ imports:[ CommonModule ]...})

Sign up to request clarification or add additional context in comments.

3 Comments

may I import this module in app.module.ts file?
Yes, but see more information about sharing modules here Sharing NgModules. Also, another important consideration is that Angular performs tree-shaking to remove unused source code and reduces the overall size of the application bundles so that the browser loads the application faster.
@KibéM.C - That would be just wrong. ebduhon gave the correct answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.