Skip to content

Instantly share code, notes, and snippets.

@vorant94
Created September 12, 2023 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vorant94/8767e99e2575fc0c3629920334c33eca to your computer and use it in GitHub Desktop.
Save vorant94/8767e99e2575fc0c3629920334c33eca to your computer and use it in GitHub Desktop.
an example of how to load scripts in angular without polluting index.html
...
@Component({
...
})
export class AppComponent implements OnInit{
constructor(private readonly http: HttpClient) {
}
ngOnInit() {
this.http.jsonp('https://www.google.com/recaptcha/api.js?render=reCAPTCHA_site_key', 'callback')
.subscribe(() => {});
}
}
...
@NgModule({
...
imports: [
...
HttpClientModule,
HttpClientJsonpModule,
],
...
})
export class AppModule { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment