Open eluizbr opened 5 years ago
We are facing same issue, any updates on it?
I'm also facing same issue. Is there any update ?
I also had the same issue. The issue was that the official documentation says to import as :
import { HttpClientModule } from '@angular/common/http'; import { EmbedVideo } from 'ngx-embed-video';
@NgModule({ imports: [HttpClientModule, EmbedVideo.forRoot()] }) export class AppModule {}
the solution is to import EmbedVideoService and not EmbedVideo as
import { EmbedVideoService } from 'ngx-embed-video';
@NgModule({ imports: [], providers:[EmbedVideoService] }) export class AppModule {}
I hope its helpful
Hi
I found another way to fix this issue. I created a provider:
import { HttpClient } from '@angular/common/http';
import { EmbedVideoService } from 'ngx-embed-video/dist';
import { EmbedVideoServiceFactory } from './embed-video-service.factory';
import { DomSanitizer } from '@angular/platform-browser';
export const EmbedVideoServiceProvider = {
provide: EmbedVideoService,
useFactory: EmbedVideoServiceFactory,
deps: [ HttpClient, DomSanitizer ]
};
also, the factory used:
import { HttpClient } from '@angular/common/http';
import { DomSanitizer } from '@angular/platform-browser';
import { EmbedVideoService } from 'ngx-embed-video/dist';
export const EmbedVideoServiceFactory = function(http: HttpClient, sanitizer: DomSanitizer ) {
return new EmbedVideoService(http, sanitizer);
};
then, add it on providers
array:
@NgModule({
providers: [
EmbedVideoServiceProvider
]
})
export class MyModule {
}
Thanks cguilhermef for your comment and solution, this helped me solve the final issue running this component in production. For others, cguilhermef's solution solved another error I was receiving once I was able to use AOT compilation. Here is the error I was receiving: ERROR TypeError: Cannot read property 'bypassSecurityTrustHtml' of undefined at n.sanitize_iframe (main.65f0c9c22c382098f35a.js:1) at n.embed_vimeo (main.65f0c9c22c382098f35a.js:1) at n.showSSVideo (main.65f0c9c22c382098f35a.js:1) ... Hope this helps
I also had the same issue. The issue was that the official documentation says to import as :
import { HttpClientModule } from '@angular/common/http'; import { EmbedVideo } from 'ngx-embed-video';
@NgModule({ imports: [HttpClientModule, EmbedVideo.forRoot()] }) export class AppModule {}
the solution is to import EmbedVideoService and not EmbedVideo as
import { EmbedVideoService } from 'ngx-embed-video';
@NgModule({ imports: [], providers:[EmbedVideoService] }) export class AppModule {}
I hope its helpful
I got it working using your solution @lazymesh. Thanks dude.
Thanks cguilhermef for your comment and solution, this helped me solve the final issue running this component in production. For others, cguilhermef's solution solved another error I was receiving once I was able to use AOT compilation. Here is the error I was receiving: ERROR TypeError: Cannot read property 'bypassSecurityTrustHtml' of undefined at n.sanitize_iframe (main.65f0c9c22c382098f35a.js:1) at n.embed_vimeo (main.65f0c9c22c382098f35a.js:1) at n.showSSVideo (main.65f0c9c22c382098f35a.js:1) ... Hope this helps
Yes exactly it resolved 2 issues mentioned perfectly. Thanks for solution @cguilhermef as it is much more convenient than another one. Also thanks @begolf for highlighting.
Hello, I am getting this error with Vimeo:
Access to XMLHttpRequest at 'https://vimeo.com/api/v2/video/10549781.json' from origin ( myurl ) has been blocked by CORS policy: Request header field authorization is not allowed by Access-Control-Allow-Headers in preflight response.
Has anyone else this issue?
Thank you.
Hi,
I have an issue on Angular 6.0.3
There support to this version ?
Thanks!