cloudinaryJsLib.Cloudinary不是构造函数Angular 6 Cloudinary

时间:2018-07-05 09:53:33

标签: angular service cloudinary

我尝试将Cloudinary集成到我的Angular版本6.0.5项目中,但出现此错误:

  

cloudinaryJsLib.Cloudinary不是构造函数

在第66行的cloudinary.service.js中

这是我的app.module.ts

...

import { Cloudinary as CloudinaryCore } from 'cloudinary-core';
import { CloudinaryConfiguration, CloudinaryModule } from '@cloudinary/angular-5.x';
import { Cloudinary } from '@cloudinary/angular-5.x/src/cloudinary.service';

export const cloudinary = { Cloudinary: CloudinaryCore };
export const config: CloudinaryConfiguration = { cloud_name: environment.CLOUDINARY_NAME,  upload_preset: environment.CLOUDINARY_PRESENT };


export function HttpLoaderFactory(httpClient: HttpClient) {
    return new TranslateHttpLoader(httpClient);
}

@NgModule({
    declarations: [
        AppComponent,
        LoginComponent,
        SelRegionComponent,
        SelAreaComponent
    ],
    imports: [
        BrowserModule,
        AppRoutingModule,
        HttpClientModule,
        FileUploadModule,
        FormsModule,

        CloudinaryModule.forRoot(cloudinary, config),

        TranslateModule.forRoot({
            loader: {
                provide: TranslateLoader,
                useFactory: HttpLoaderFactory,
                deps: [HttpClient]
            }
        })
    ],
    providers: [TranslationSettingsService],
    bootstrap: [AppComponent]
})
export class AppModule { }

,这里是代码模板:

<cl-image public-id="problem.images[0].public_id">
         <cl-transformation alt="A sample photo" className="Samples">
          </cl-transformation>
</cl-image>

Angular CLI:6.0.8,节点:8.11.2,Angular:6.0.5

1 个答案:

答案 0 :(得分:1)

请看以下示例,以获取有关与Cloudinary- https://github.com/cloudinary/cloudinary_angular/tree/master/samples/angular-cli-sample

集成的更多信息。