1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

PrimeNG calendar form component Error: Failed to execute 'getComputedStyle' on 'Window':...

Discussão em 'Angular' iniciado por user20589877, Outubro 2, 2024 às 16:13.

  1. user20589877

    user20589877 Guest

    When using PrimeNG's Calendar form component, I get the following error as soon as I click on the calendar form:

    screenshot of error

    The error is not coming from any of my files, and I have been googling and googling and haven't been able to figure out what's happening. It says that "parameter 1 is not of type 'element'", but I am not trying to pass anything into anything else. The error occurs on any interaction with the calendar form. Basically, it renders it to the screen, and displays today's date in the form, when I click on it the whole calendar expands like this:

    screenshot of calendar form

    But for every interaction, another instance of the same error appears in the console. I am new to Angular so I'm feeling a little frustrated with this one!

    Thanks so much in advance!!!

    calendar.component.ts:

    import { Component, OnInit } from '@angular/core';

    @Component({
    selector: 'app-calendar',
    templateUrl: './calendar.component.html',

    })
    export class CalendarComponent implements OnInit {

    fromDate: Date = new Date;
    toDate: Date = new Date;

    ngOnInit(): void {}

    }


    calendar.component.html:

    <label for="fromDate">Choose start date: </label>
    <p-calendar [(ngModel)]="fromDate" dateFormat="dd/mm/yy"></p-calendar>
    <label for="toDate"> Choose end date: </label>
    <p-calendar [(ngModel)]="toDate" dateFormat="dd/mm/yy"></p-calendar>

    Continue reading...

Compartilhe esta Página