The 'ngForOf' directive cannot be bound to 'div' element as it is not recognized as a valid property

Encountering an issue with adding an ngFor directive on a div, which is causing a warning and preventing my HTML from rendering properly.

I experimented with using *ngFor on various elements like <li>, <tr>, and <span>, but kept getting the same error message. It works fine in other sections of my code but not here (I have not used it within <p-dialog> elsewhere).

If the problem lies with a missing module in app.component.ts, I'm having trouble identifying which one is actually missing.

my-page.component.html

<p-dialog [(visible)]="displayPopup"
          [style]="{minWidth: '716px', minHeight: '270px', height:'50%'}"
          [baseZIndex]="10000"
          [modal]="true"
          [responsive]="true"
          [maximizable]="true">
  <p-header>

    <div *ngfor="let model of models">
      {{model.name}} Update
    </div>
  </p-header>
  <div style="min-height:335px!important">
    <app-newComponent #newComp
                    [data1]="data1"
                    [data2]="data2"
                    (onChange)="onModelditChange($event)"></app-newComponent >
  </div>
  <p-footer>
    <button type="button" pButton icon="pi pi-times" (click)="updateModel()" label="Save"></button>
  </p-footer>
</p-dialog>

app.module.ts

@NgModule({
  imports: [
    BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
    ReactiveFormsModule,
    HttpClientModule,
    CommonModule,
    AuthModule.forRoot(),
    FormsModule,
    routing,
    AccordionModule,
    BrowserAnimationsModule,
    TreeTableModule,
    ... (list of imported modules has been shortened for brevity)
  ],
}

Answer №1

It appears that there was a mistake made with the structural directive. The correct syntax is *ngFor, not *ngfor

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to Reload the Active Tab in Angular 5?

In my project, I have noticed that a listener in one of the tabs causes the entire tab to refresh, resulting in it displaying information from the first tab until I switch to another tab and then go back. 1) Is there a way to refresh only the current tab? ...

Incorporating an offset with the I18nPluralPipe

Having trouble with my multiselect dropdown and the text pluralization. I attempted to use the I18nPluralPipe, but can't seem to set an offset of 1. ListItem = [Lion, Tiger, Cat, Fox] Select 1 Item(Tiger) = "Tiger", Select 3 Item(Tiger, Cat, Fox) = ...

Utilizing PrimeNG menu items to bind commands to a base class function

I'm struggling to connect a parent class function with my Angular 2 PrimeNG menu options. HTML <p-menu #menu popup="popup" [model]="exportItems"></p-menu> <button type="button" class="fa fa-download" title="Export As" (click)="menu.to ...

An issue is preventing the Angular 2+ http service from making the requested call to the server

I am looking to create a model class that can access services in Angular. Let's say I have the following endpoints: /book/:id /book/:id/author I want to use a service called BooksService to retrieve a list of Book instances. These instances should ...

Is it possible to manually activate a dropdown event using pure JavaScript?

I am attempting to manually trigger a dropdown event using JavaScript. Below is the function where I am trying to achieve this. I have successfully halted the initial event that occurs and now I need to initiate a dropdown event. stopNavigationTriggerDrop ...

Angular 2 is reporting the error message "No 'Access-Control-Allow-Origin' header is present on the requested resource" when using the http.get function

Encountered the following issue: Response to preflight request fails access control check: 'Access-Control-Allow-Origin' header missing in requested resource. Issue arises when attempting a request to my web API from my Angular2 application: ...

Can you explain the functionality of this code snippet from a slate.js demonstration?

Trying to grasp the concepts of Slate.js, I delved into the rich text example. Within it, I encountered a code snippet that has left me puzzled. const isBlockActive = (editor, format) => { const [match] = Editor.nodes(editor, { match: n => ...

Typescript is throwing a fit over namespaces

My development environment consists of node v6.8.0, TypeScript v2.0.3, gulp v3.9.1, and gulp-typescript v3.0.2. However, I encounter an error when building with gulp. Below is the code snippet that is causing the issue: /// <reference path="../_all.d. ...

Create an interface that inherits from another in MUI

My custom interface for designing themes includes various properties such as colors, border radius, navbar settings, and typography styles. interface ThemeBase { colors: { [key: string]: Color; }; borderRadius: { base: string; mobile: st ...

Ensuring that a date is within a certain format in TypeScript

Can someone help me verify the validity of different date formats? I attempted the following method: let newdate = new Date(myStringDate); Date.parse(myStringDate) result = `${newdate.getDate()}/${newdate.getMonth() + 1}/${newdate.getFullYear()}` The re ...

Issues with using a personalized font in a Stenciljs project

Looking for guidance on implementing a custom font in my Stenciljs app. I have the otf file, unsure if an npm package is necessary. Here's my code: filestructure: -src --components --assets ---Anurti-Regular.tiff ---Anurti-Regular.ttf friends-l ...

Creating a downloadable text file in Angular

I need help with including data retrieved from an API GET call into a text file within my project. I have successfully called the API, displayed the data on the console and the webpage, but now I am struggling to save this data into a text file. Below is t ...

The function's overloading is not compatible with its implementation

Currently, I am puzzled by the lack of functionality in some code that I am reviewing. The structure resembles this: function getValidity(x: "v1"): boolean; function getValidity(x: "v2"): { a: number; b: number }; function getValidity(x: any) { if (x == ...

Exploring Angular: Adding elements to formArray and tracking form value modifications

I am currently working on a Form that utilizes a formArray : initForm() { this.mainForm = this.formBuilder.group({ foos: this.formBuilder.array([], [Validators.required]), }); getFoos(): FormArray { return this.mainForm.get(&apos ...

Steps to filter types by a singular property assessment

export type HalfSpin = { halfspin: string } export type FullSpin = { fullspin: string } export type SpinType = | HalfSpin | FullSpin export function isHalfSpin(_: SpinType) ...

Exploring Angular data iteration with Tab and its contentLearn how to loop through Tab elements

Upon receiving a response from the API, this is what I get: const myObj = [ { 'tabName': 'Tab1', 'otherDetails': [ { 'formType': 'Continuous' }, { 'formType& ...

Encountered an error while attempting to compare 'true' within the ngDoCheck() function in Angular2

Getting Started Greetings! I am a novice in the world of Angular2, Typescript, and StackOverflow.com. I am facing an issue that I hope you can assist me with. I have successfully created a collapse animation for a button using ngOnChanges() when the butto ...

I am encountering some difficulties in the installation process of Angular CLI

Encountering an error trying to install angular cli despite updating both node and npm. https://i.stack.imgur.com/SpkNU.jpg ...

Implementing Azure Active Directory Authentication for Angular 4 or Angular 2 - Retrieving Access Tokens

I'm in the process of authenticating an Angular 4/Angular 2 app with Azure Active Directory to obtain a token code for passing as a Bearer token when calling a REST API. For this purpose, I've utilized 'ng2-adal' available at https://g ...

typescriptUsing redux: prevent parent component from accessing redux props

I'm currently using redux and typescript in my webapp project. What's the best approach for defining props in a component that receives redux-actions through @connect, as well as props from its parent? // mychild.tsx export namespace MyChildCom ...