primeng icon indicating copy to clipboard operation
primeng copied to clipboard

P-dropdown validation not working with class objects

Open Anirudh16 opened this issue 1 year ago • 0 comments

Describe the bug

P-dropdown showing as valid when a class with objects are used for ngModel instead of interface like below.

export class City { public name: string = ""; public code: string = ""; }

Environment

Primeng: 17.13.0 Angular 17.3.1

Reproducer

https://codesandbox.io/s/primeng-dropdown-basic-demo-forked-vpq54r?file=/src/app/demo/dropdown-basic-demo.ts

Angular version

17.3.1

PrimeNG version

17.13.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

16.16

Browser(s)

No response

Steps to reproduce the behavior

  1. Go to https://codesandbox.io/s/primeng-dropdown-basic-demo-forked-vpq54r?file=/src/app/demo/dropdown-basic-demo.ts
  2. Added two dropdowns with first dropdown as null and second dropdown as class instance
  3. When dropdown is opened and closed without any selection it should provide validation message
  4. For first dropdown it would throw validation but for second dropdown it would not throw any message

Expected behavior

No response

Anirudh16 avatar Sep 29 '23 09:09 Anirudh16