1

I would like to use in one of my components this effect:

https://codepen.io/linrock/pen/Amdhr

my first approach was to try to translate the javascript to typescript, but then I gave up and I decided to copy the js file that you can find in the codepen and try to import it in my application.

Then, I copied the file in src/app/scripts/confetti.js and then I tried to import it in my index.html

<script src="scripts/confetti.js"></script>

But I get that the file confetti.js is not found when I run my app.

Do you know what I am doing wrong?

2

1 Answer 1

4

you need to copy your js file to "src/resources/js/" and then include it in your .angular-cli.json

"scripts": [
        "resources/js/confetti.js"
           ],
Sign up to request clarification or add additional context in comments.

4 Comments

@incancer how can i import that to my index.html file
@SantoshrajuV you dont... i recommend you to use Angular CLI which will create the folder and file structure for you! Then you will see a ".angular-cli.json" file where you can include your js and css files.
i have included but it is showing filenot fouund error
Then it seems like ur file is not there.. make sure you are including the right files .js or .ts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.