Integrate adf in existing project

cancel
Showing results for 
Search instead for 
Did you mean: 
anakin98000
Active Member

Integrate adf in existing project

Hello,

 

this is what i try to add alfresco ecm only in existing angular 15 :

thank you,


package.json:
"dependencies": {
"@alfresco/adf-content-services": "^7.0.0-alpha.2",    // works with angular 15
"@alfresco/adf-core": "^7.0.0-alpha.2",
"@alfresco/adf-extensions": "^7.0.0-alpha.2",
"@alfresco/js-api": "^8.0.0-alpha.2",
...
app.config.json:
"{
"ecmHost": "https://localhost:8443",
"providers": "ECM"
},
"application": {
"name": "MyApp"
},
"languages": [
{
"key": "en",
"label": "English"
},
{
"key": "fr",
"label": "French"
}
],"

proxy.conf :
"module.exports = {
"/alfresco": {
target: "https://localhost:8443",
secure: false,
changeOrigin: true,
// workaround for REPO-2260
onProxyRes: function(proxyRes, req, res) {
const header = proxyRes.headers['www-authenticate'];
if (header && header.startsWith('Basic')) {
proxyRes.headers['www-authenticate'] = 'x' + header;
}
}
},
logLevel: 'debug'
};"
I have added a AdfModule file that I have imported in my app.module file :

"import { NgModule } from '@angular/core';
import {CoreModule, TRANSLATION_PROVIDER, TranslateLoaderService, AppConfigService} from '@alfresco/adf-core';
import { ContentModule } from '@alfresco/adf-content-services';
import {TranslateLoader, TranslateModule} from "@ngx-translate/core";

@NgModule({
imports: [
// ADF modules
CoreModule.forRoot(),
ContentModule.forRoot(),
TranslateModule.forRoot({
loader: { provide: TranslateLoader, useClass: TranslateLoaderService }
})
],
providers: [
AppConfigService,
{
provide: TRANSLATION_PROVIDER,
multi: true,
useValue: {
name: 'app',
source: 'assets/i18n'
}
}
]
})
export class AdfModule {}
"
And in angular.json:

""assets": [
"src/favicon.ico",
"src/assets",
"src/app.config.json",
{
"glob": "/*",
"input": "resources",
"output": "/resources"
},
{
"glob": "
/",
"input": "node_modules/@alfresco/adf-core/prebuilt-themes",
"output": "/assets/prebuilt-themes"
},
{
"glob": "**/
",
"input": "node_modules/@alfresco/adf-core/bundles/assets",
"output": "/assets"
},
{
"glob": "**/*",
"input": "node_modules/@alfresco/adf-content-services/bundles/assets",
"output": "/assets"
},
{
"glob": "pdf.worker.js",
"input": "node_modules/pdfjs-dist/build",
"output": "/"
},
{
"glob": "pdf.worker.min.js",
"input": "node_modules/pdfjs-dist/build",
"output": "/"
}
],"

But I have an injection issue : "NullInjectorError: No provider for r!"
I think by checking code that it comes from AuthenticationService in adf-core.mjs

What is missing ?

Thank you in advance

3 Replies
anakin98000
Active Member

Re: Integrate adf in existing project

no one has ever had the problem ? Is my config ok ? I don't find any tuto that shows how to add adf in existing app. Thank you in advance !

anakin98000
Active Member

Re: Integrate adf in existing project

Here is the original error:

 

ERROR NullInjectorError: R3InjectorError(AppModule)[ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> VersionCompatibilityService -> DiscoveryApiService -> AuthenticationService -> RedirectAuthService -> RedirectAuthService -> RedirectAuthService]:
NullInjectorError: No provider for RedirectAuthService!
at NullInjector.get (core.mjs:7493:27)
at R3Injector.get (core.mjs:7914:33)
at R3Injector.get (core.mjs:7914:33)
at R3Injector.get (core.mjs:7914:33)
at injectInjectorOnly (core.mjs:618:33)
at Module.ɵɵinject (core.mjs:622:60)
at Object.AuthenticationService_Factory [as factory] (adf-core.mjs:135:114)
at R3Injector.hydrate (core.mjs:8015:35)
at R3Injector.get (core.mjs:7903:33)
at injectInjectorOnly (core.mjs:618:33)
at Module.ɵɵinject (core.mjs:622:60)
at Object.DiscoveryApiService_Factory [as factory] (adf-content-services.mjs:104:108)
at R3Injector.hydrate (core.mjs:8015:35)
at R3Injector.get (core.mjs:7903:33)
at injectInjectorOnly (core.mjs:618:33)
at Module.ɵɵinject (core.mjs:622:60)

anakin98000
Active Member

Re: Integrate adf in existing project

OK, 

AuthModule.forRoot({ useHash: true }), 

was missing