Created
September 12, 2023 07:18
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
@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(() => {}); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
@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