Hi,
I really need your support to fix the issue while migrating from v9.0.8 -> v9.1.3 on Angular only.
packages.json
{
"name": "MyProject",
"version": "2.0.0",
"engines": {
"node": "^22.0.0"
},
"scripts": {
"ng": "ng",
"start": "ng serve --open",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"lint": "ng lint"
},
"private": true,
"dependencies": {
"@abp/ng.components": "~9.1.3",
"@abp/ng.feature-management": "~9.1.3",
"@abp/ng.core": "~9.1.3",
"@abp/ng.oauth": "~9.1.3",
"@abp/ng.setting-management": "~9.1.3",
"@abp/ng.theme.shared": "~9.1.3",
"@angular/animations": "~19.1.8",
"@angular/common": "~19.1.8",
"@angular/compiler": "~19.1.8",
"@angular/core": "~19.1.8",
"@angular/forms": "~19.1.8",
"@angular/localize": "~19.1.8",
"@angular/platform-browser": "~19.1.8",
"@angular/platform-browser-dynamic": "~19.1.8",
"@angular/router": "~19.1.8",
"@progress/kendo-angular-buttons": "^18.5.2",
"@progress/kendo-angular-charts": "^18.5.2",
"@progress/kendo-angular-common": "^18.5.2",
"@progress/kendo-angular-dateinputs": "^18.5.2",
"@progress/kendo-angular-dialog": "^18.5.2",
"@progress/kendo-angular-dropdowns": "^18.5.2",
"@progress/kendo-angular-excel-export": "^18.5.2",
"@progress/kendo-angular-grid": "^18.5.2",
"@progress/kendo-angular-icons": "^18.5.2",
"@progress/kendo-angular-inputs": "^18.5.2",
"@progress/kendo-angular-intl": "^18.5.2",
"@progress/kendo-angular-l10n": "^18.5.2",
"@progress/kendo-angular-label": "^18.5.2",
"@progress/kendo-angular-layout": "^18.5.2",
"@progress/kendo-angular-menu": "^18.5.2",
"@progress/kendo-angular-navigation": "^18.5.2",
"@progress/kendo-angular-pager": "^18.5.2",
"@progress/kendo-angular-pdf-export": "^18.5.2",
"@progress/kendo-angular-popup": "^18.5.2",
"@progress/kendo-angular-progressbar": "^18.5.2",
"@progress/kendo-angular-treelist": "^18.5.2",
"@progress/kendo-angular-treeview": "^18.5.2",
"@progress/kendo-angular-utils": "^18.5.2",
"@progress/kendo-angular-toolbar": "^18.5.2",
"@progress/kendo-data-query": "^1.7.1",
"@progress/kendo-drawing": "^1.21.2",
"@progress/kendo-licensing": "^1.5.3",
"@progress/kendo-svg-icons": "^4.5.0",
"@progress/kendo-theme-default": "^10.3.1",
"@volo/abp.commercial.ng.ui": "~9.1.3",
"@volo/abp.ng.account": "~9.1.3",
"@volo/abp.ng.audit-logging": "~9.1.3",
"@volo/abp.ng.chat": "~9.1.3",
"@volo/abp.ng.file-management": "~9.1.3",
"@volo/abp.ng.gdpr": "~9.1.3",
"@volo/abp.ng.identity": "~9.1.3",
"@volo/abp.ng.language-management": "~9.1.3",
"@volo/abp.ng.openiddictpro": "~9.1.3",
"@volo/abp.ng.saas": "~9.1.3",
"@volo/abp.ng.text-template-management": "~9.1.3",
"@volosoft/abp.ng.theme.lepton-x": "~4.1.3",
"chart.js": "^3.8.0",
"chartjs-plugin-datalabels": "^2.0.0",
"file-saver": "^2.0.5",
"hammerjs": "^2.0.0",
"jstree": "^3.3.12",
"ng-zorro-antd": "^18.2.1",
"ng2-charts": "^3.0.11",
"ngx-datatable": "^1.0.3",
"pako": "^2.0.4",
"rxjs": "~7.8.0",
"tslib": "^2.0.0",
"uuid": "^9.0.1",
"zone.js": "~0.15.0"
},
"devDependencies": {
"@abp/ng.schematics": "~9.1.3",
"@angular-devkit/build-angular": "~19.1.9",
"@angular-eslint/builder": "^19.8.1",
"@angular-eslint/eslint-plugin": "^19.8.1",
"@angular-eslint/eslint-plugin-template": "^19.8.1",
"@angular-eslint/schematics": "^19.8.1",
"@angular-eslint/template-parser": "^19.8.1",
"@angular/cli": "~19.1.9",
"@angular/compiler-cli": "~19.1.8",
"@angular/language-service": "~19.1.8",
"@types/file-saver": "^2.0.7",
"@types/jasmine": "~3.6.0",
"@types/jszip": "^3.4.0",
"@types/node": "^20.17.16",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.0.0",
"jasmine-core": "~4.0.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.1.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.0.0",
"ng-packagr": "~18.2.1",
"typescript": "~5.5.4"
}
}
This is the main.ts
file
import { provideAbpCore, withOptions } from '@abp/ng.core';
import { provideFeatureManagementConfig } from '@abp/ng.feature-management';
import { provideAbpOAuth } from '@abp/ng.oauth';
import { provideSettingManagementConfig } from '@abp/ng.setting-management/config';
import { provideAbpThemeShared, withHttpErrorConfig } from '@abp/ng.theme.shared';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import {
enableProdMode,
importProvidersFrom,
provideZoneChangeDetection,
} from '@angular/core';
import { bootstrapApplication, BrowserModule } from '@angular/platform-browser';
import {
BrowserAnimationsModule,
provideAnimations,
} from '@angular/platform-browser/animations';
import { provideRouter } from '@angular/router';
import { provideCommercialUiConfig } from '@volo/abp.commercial.ng.ui/config';
import { provideAccountAdminConfig } from '@volo/abp.ng.account/admin/config';
import { provideAccountPublicConfig } from '@volo/abp.ng.account/public/config';
import { provideAuditLoggingConfig } from '@volo/abp.ng.audit-logging/config';
import { provideChatConfig } from '@volo/abp.ng.chat/config';
import { provideFileManagementConfig } from '@volo/abp.ng.file-management/config';
import { provideGdprConfig, withCookieConsentOptions } from '@volo/abp.ng.gdpr/config';
import { provideIdentityConfig } from '@volo/abp.ng.identity/config';
import { provideLanguageManagementConfig } from '@volo/abp.ng.language-management/config';
import { registerLocale } from '@volo/abp.ng.language-management/locale';
import { provideOpeniddictproConfig } from '@volo/abp.ng.openiddictpro/config';
import { provideSaasConfig } from '@volo/abp.ng.saas/config';
import { provideTextTemplateManagementConfig } from '@volo/abp.ng.text-template-management/config';
import { HttpErrorComponent, ThemeLeptonXModule } from '@volosoft/abp.ng.theme.lepton-x';
import { SideMenuLayoutModule } from '@volosoft/abp.ng.theme.lepton-x/layouts';
import { routes } from './app/app-routing.module';
import { AppComponent } from './app/app.component';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
bootstrapApplication(AppComponent, {
providers: [
provideAbpCore(withOptions({ environment, registerLocaleFn: registerLocale() })),
provideAbpOAuth(),
// provideIdentityConfig(),
provideSettingManagementConfig(),
provideFeatureManagementConfig(),
// provideAccountAdminConfig(),
// provideAccountPublicConfig(),
// provideCommercialUiConfig(),
provideAbpThemeShared(
withHttpErrorConfig({
errorScreen: {
component: HttpErrorComponent,
forWhichErrors: [401, 403, 404, 500],
hideCloseIcon: true,
},
})
),
// provideGdprConfig(
// withCookieConsentOptions({
// cookiePolicyUrl: '/gdpr-cookie-consent/cookie',
// privacyPolicyUrl: '/gdpr-cookie-consent/privacy',
// })
// ),
// provideLanguageManagementConfig(),
// provideSaasConfig(),
// provideAuditLoggingConfig(),
// provideOpeniddictproConfig(),
// provideTextTemplateManagementConfig(),
provideChatConfig(),
provideFileManagementConfig(),
importProvidersFrom(
BrowserModule,
BrowserAnimationsModule,
ThemeLeptonXModule.forRoot(),
SideMenuLayoutModule.forRoot()
),
provideAnimations(),
provideHttpClient(withInterceptorsFromDi()),
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes),
],
});
This is the version the app can run without issues. If I uncomment the provider methods such as provideIdentityConfig
, provideAccountAdminConfig
, provideAccountPublicConfig
, provideCommercialUiConfig
, provideGdprConfig
, provideLanguageManagementConfig,
provideSaasConfig
, provideAuditLoggingConfig
, provideOpeniddictproConfig
, provideTextTemplateManagementConfig
=> then I will get the error "NullInjectorError: No provider for InjectionToken CORE_OPTIONS!"
I've set up a minimal app to have the same like the freshly generated app by using ABP Studio for microservices architecture.The new one is runnable, but applied to my project is not.
Here is the app.component.ts
file.
@Component({
selector: 'app-root',
template: `
<abp-loader-bar></abp-loader-bar>
<abp-dynamic-layout></abp-dynamic-layout>
<abp-gdpr-cookie-consent></abp-gdpr-cookie-consent>
`,
styleUrls: ['./app.component.scss'],
imports: [
CoreModule,
ThemeSharedModule,
GdprConfigModule,
]
})
export class AppComponent { }
I appreciate any support in advance. Thanks!
8 Answer(s)
-
0
The error "NullInjectorError: No provider for InjectionToken CORE_OPTIONS!" in your ABP Angular v9.1.3 migration is caused by missing or misconfigured ABP core providers. In ABP v9+, the dependency injection system for Angular was updated to use the new Angular standalone providers API, and all ABP modules must be registered using their new
provide*Config
orprovide*
functions.Solution
Do not import ABP modules in the
imports
array of your components or modules.
Instead, use the newprovideAbpCore
and related provider functions only in thebootstrapApplication
call in yourmain.ts
.Remove all ABP modules from the
imports
array in your@Component
and@NgModule
decorators.
For example, in yourapp.component.ts
, remove:
imports: [ CoreModule, ThemeSharedModule, GdprConfigModule, ]
These should not be present.
- Ensure all ABP providers are registered in
main.ts
using the new provider functions.
For example:
bootstrapApplication(AppComponent, { providers: [ provideAbpCore(withOptions({ environment, registerLocaleFn: registerLocale() })), provideAbpOAuth(), provideSettingManagementConfig(), provideFeatureManagementConfig(), provideAbpThemeShared( withHttpErrorConfig({ errorScreen: { component: HttpErrorComponent, forWhichErrors: [401, 403, 404, 500], hideCloseIcon: true, }, }) ), // ...other provide*Config functions importProvidersFrom( BrowserModule, BrowserAnimationsModule, ThemeLeptonXModule.forRoot(), SideMenuLayoutModule.forRoot() ), provideAnimations(), provideHttpClient(withInterceptorsFromDi()), provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes), ], });
If you comment out any
provide*Config
function, any dependent module will fail to resolve its options.
For example, if you use any ABP module (like Identity, Account, etc.), you must include its correspondingprovide*Config
function in the providers array.Do not mix the old module-based imports with the new provider-based registration.
All ABP modules must be registered via providers only.
Example Correction
- Remove all ABP modules from
imports
inapp.component.ts
and any other module/component. - Register all needed ABP providers in
main.ts
only.
Reference Example
See the official ABP v9 Angular startup template for a working example:
By following these steps, the "No provider for InjectionToken CORE_OPTIONS!" error will be resolved, and your ABP Angular app will work as expected after migration.
This approach aligns with common ABP conventions, but specific official documentation for this exact scenario is not available.
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
The generated answer by AI does not help. I need a person to support this one. Additionally, we're using ABP commercial packages.
-
0
hi
Our angular team will help you asap
Thanks.
-
0
Hello,
I see that you are configuring your app to run as a standalone application. ABP will offer full support for this structure starting with the upcoming version 9.3, which will be released soon. You can follow the release updates here: https://github.com/abpframework/abp/releases.
If you are hesitant to upgrade to version 9.3 right away, you may consider using version 9.2, which provides more stability in this regard.
Feel free to reach out if you need any further assistance. Thank you for your cooperation.
-
0
Hello,
Thank you, the version 9.2 fixed my problem, another issue comes in, why do I get the layout without side menu on our modules (e.g Home page).
If I route to http://localhost:4200/saas on the URL browser, then I will get the side menu.
Here is the registered providers & my home.component
Entry main
bootstrapApplication(AppComponent, { providers: [ APP_ROUTE_PROVIDER, CUSTOM_MENU_ITEM, provideAnimations(), provideZoneChangeDetection({ eventCoalescing: true }), provideAbpCore(withOptions({ environment, registerLocaleFn: registerLocale() })), provideAbpOAuth(), provideAbpThemeShared(), provideAccountAdminConfig(), provideAccountPublicConfig(), provideIdentityConfig(), provideTenantManagementConfig(), provideSaasConfig(), provideSettingManagementConfig(), provideOpeniddictproConfig(), provideLanguageManagementConfig(), provideChatConfig(), provideGdprConfig( withCookieConsentOptions({ privacyPolicyUrl: 'gdpr-cookie-consent/privacy', cookiePolicyUrl: 'gdpr-cookie-consent/cookie', }) ), provideFileManagementConfig(), provideAuditLoggingConfig(), provideTextTemplateManagementConfig(), provideCommercialUiConfig(), provideFeatureManagementConfig(), provideRouter(routes), importProvidersFrom( ThemeLeptonXModule.forRoot(), SideMenuLayoutModule.forRoot(), ProductServiceConfigModule.forRoot() ), ], });
AppRoutes
// app.routes.ts export const routes: Routes = [ { path: 'home', pathMatch: 'full', loadChildren: () => import('./home/home.module').then(m => m.HomeModule), canActivate: [authGuard, permissionGuard], }, ... ];
Home Module
// home.module.ts @NgModule({ imports: [SharedModule, HomeRoutingModule, PageModule, HomeComponent], }) export class HomeModule {} // home-routing.module.ts const routes: Routes = [{ path: '', component: HomeComponent, pathMatch: 'full', }]; @NgModule({ imports: [RouterModule.forChild(routes)], exports: [RouterModule], }) export class HomeRoutingModule {} // home.component.ts @Component({ selector: 'app-home', templateUrl: './home.component.html', styleUrls: ['./home.component.scss'], imports: [AnalysisModelComponent], }) export class HomeComponent { get hasLoggedIn(): boolean { return this.oAuthService.hasValidAccessToken(); } constructor(private oAuthService: OAuthService, private authService: AuthService) {} login() { this.authService.navigateToLogin(); } } // home.component.html <h2>Home</h2> <div class="card"> <div class="card-body"> <h2>My Work</h2> <app-my-model [isShowOnHomePage]="true"></app-my-model> </div> </div>```
-
0
Hello again, Thank you for your response. I am glad to hear that the version 9.2 is worked on your side.
Thank you, the version 9.2 fixed my problem, another issue comes in, why do I get the layout without side menu on our modules (e.g Home page).
I have also tried to add a component by following the details you have provided. Here is how it looks on the home route for example:
Could you tell me whether you see any error log on the console?
-
0
Hi,
No I don't get any errors.
I can see the difference that ABP core modules use ApplicationLayout, but my component uses EmptyLayout.
Could you tell me what config to set the layout. As I know, we don't migrate or touch any configuration related to the layout.
UPDATE
That's my fault, I migrated to use
provideAppInitializer
for APP_ROUTE_PROVIDER provider, but did not fully migrate yet.Here is the right one
export const APP_ROUTE_PROVIDER = [ provideAppInitializer(() => { configureRoutes(); }), ]; function configureRoutes() { const routes = inject(RoutesService); routes.add([ ... ]); }
-
0
Hello again,
Thank you for the update. I am happy to hear if this has solved your problem. Is there anything I could assist you further on this matter?