Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Themes not working in v19 with Angular v19 #17760

Open
almenke opened this issue Feb 24, 2025 · 2 comments
Open

Themes not working in v19 with Angular v19 #17760

almenke opened this issue Feb 24, 2025 · 2 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@almenke
Copy link

almenke commented Feb 24, 2025

I have worked many hours on this and I cannot figure out how to get the themes working in v19. I just tested with a simple and every theme I throw at it, this button is still green. I think it falls back to no theme. Here is my current version setup in package.json

"dependencies": {
"@angular/animations": "^19.1.0",
"@angular/common": "^19.1.0",
"@angular/compiler": "^19.1.0",
"@angular/core": "^19.1.0",
"@angular/forms": "^19.1.0",
"@angular/platform-browser": "^19.1.0",
"@angular/platform-browser-dynamic": "^19.1.0",
"@angular/router": "^19.1.0",
"@primeng/themes": "^19.0.7",
"@tailwindcss/postcss": "^4.0.8",
"date-fns": "^4.1.0",
"ngx-spinner": "^19.0.0",
"postcss": "^8.5.3",
"primeicons": "^7.0.0",
"primeng": "^19.0.7",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.15.0"
},

Here is my app.config.ts
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';
import { routes } from './app.routes';
import { provideHttpClient, withInterceptors } from '@angular/common/http';
import { jwtInterceptor } from './_interceptors/jwt';
import { loadingInterceptor } from './_interceptors/loading';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import { providePrimeNG } from 'primeng/config';
import Lara from '@primeng/themes/lara';

export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes),
provideHttpClient(withInterceptors([jwtInterceptor, loadingInterceptor])),
provideAnimationsAsync(),
providePrimeNG({
theme: {
preset: Lara,
options: {
darkModeSelector: 'none'
}
}
})
]
};

And here is my component
import { Component, inject } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { NgxSpinnerComponent } from 'ngx-spinner';
import { ButtonModule } from 'primeng/button';
import { AccountService } from './_services/account.service';

@component({
selector: 'app-root',
imports: [ButtonModule],
template: '

',
styleUrl: './app.component.css'
})
export class AppComponent {
accountService = inject(AccountService)

}

I tried all my favorite AI helpers and also downgraded to 19.0.5 and 19.0.6 (both of those versions failed to render due to a auto focus error. Thanks in advance for your help.

@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 24, 2025
@gzeeel
Copy link

gzeeel commented Feb 25, 2025

Hello @almenke, I'm not sure if you're using TailwindCSS or not, but if you do, could you try setting the following config for providePrimeNG please ?

theme: {
     preset: Lara,
        options: {
          cssLayer: {
            name: 'primeng',
            order: 'tailwind, primeng'
          },
          darkModeSelector: 'none'
     }
}

@Eptick
Copy link

Eptick commented Feb 28, 2025

+1
Clean project setup not working.

{
  "name": "frontend",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^19.1.0",
    "@angular/common": "^19.1.0",
    "@angular/compiler": "^19.1.0",
    "@angular/core": "^19.1.0",
    "@angular/forms": "^19.1.0",
    "@angular/platform-browser": "^19.1.0",
    "@angular/platform-browser-dynamic": "^19.1.0",
    "@angular/router": "^19.1.0",
    "@primeng/themes": "^19.0.9",
    "primeflex": "^4.0.0",
    "primeng": "^19.0.9",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.15.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^19.1.8",
    "@angular/cli": "^19.1.8",
    "@angular/compiler-cli": "^19.1.0",
    "@types/jasmine": "~5.1.0",
    "jasmine-core": "~5.5.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.1.0",
    "typescript": "~5.7.2"
  }
}
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';

import { routes } from './app.routes';
import {provideAnimationsAsync} from '@angular/platform-browser/animations/async';
import {providePrimeNG} from 'primeng/config';
import Aura from '@primeng/themes/aura';


export const appConfig: ApplicationConfig = {
  providers: [
    provideZoneChangeDetection({ eventCoalescing: true }),
    provideRouter(routes),
    provideAnimationsAsync(),
    providePrimeNG({
      theme: {
        preset: Aura
      }
    })
  ]
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

3 participants