Jignesh zala
Sep 30, 2022

--

In this tutorial, we will see how to load external scripts Dynamically In Angular 14.

The technique listed below can be used to dynamically load JS scripts and libraries into your Angular project as needed.

loadScript(): Promise<any> {
return new Promise((resolve, reject) => {
const script = document.createElement('script');
script.src =
'https://cdn.jsdelivr.net/npm/chart.js@3.9.1/dist/chart.min.js'
script.async = true;
script.defer = true;
document.body.appendChild(script);
});

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Jignesh zala
Jignesh zala

Written by Jignesh zala

MEAN Stack Developer and founder of TutsCoder.com, sharing tech insights, tutorials, and resources on Angular, Node.js, JavaScript, and more for developers.

No responses yet

Write a response