p-dropdown styleClass SelectItem

UI Components for Angular
Post Reply
Posts: 1
Joined: 10 Jul 2019, 12:04

10 Jul 2019, 12:14

Hello everyone,
I have a problem with customizing the single item.

I create an array of type SelectItem, to one of these items imposed the "styleClass".

Code: Select all

 public static readonly tipoProcedimento : SelectItem[] =
        { label: '(Tutte)', value: 0 },
        { label: 'Valutazione Ambientale Strategica', value: 1, styleClass: 'macroFamiglia' }
Doing the inspect element, I can't find the name I had entered in the "styleClass".

Seeing the js of the dropdown, he doesn't import the styleClass attribute into the template.

Code: Select all

    DropdownItem = __decorate([
            selector: 'p-dropdownItem',
            template: "\n        <li (click)=\"onOptionClick($event)\" role=\"option\"\n            [attr.aria-label]=\"option.label\"\n            [ngStyle]=\"{'height': itemSize + 'px'}\"\n            [ngClass]=\"{'ui-dropdown-item ui-corner-all':true,\n                                                'ui-state-highlight': selected,\n                                                'ui-state-disabled':(option.disabled),\n                                                'ui-dropdown-item-empty': !option.label||option.label.length === 0}\">\n            <span *ngIf=\"!template\"  >{{option.label||'empty'}}</span>\n            <ng-container *ngTemplateOutlet=\"template; context: {$implicit: option}\"></ng-container>\n        </li>\n    "
    ], DropdownItem);
No option.styleClass is called in this code
Is it a primeng error? am I wrong to do something?

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 19 guests