how to install a module with npm in angular 1

Question!

I am trying to install bootstrap using npm. I ran:

npm install angular-ui-bootstrap

And that succesfully installed the module in the node_modules folder. The problem is I can't seem to reference the files from index.html. I put in the following line:

<script src="/node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js"></script>

But it returns a 404. I have 3 questions:

  1. Am I referencing the right file
  2. How do I include the file in index.html
  3. If I include the file in the html, will that be enough to erase another error I'm getting:

    Error: [$injector:modulerr] Failed to instantiate module ui.bootstrap due to:
    Error: [$injector:nomod] Module 'ui.bootstrap' is not available!
    

Here is the file structure:

Project
    -app
        -index.html
    -node_modules
        -angular-ui-bootstrap
            -dist
                -ui-bootstrap.js


Answers

Just remove / from <script src="/node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js"></script> Like this:

<script src="node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js"></script>
By : George


This video can help you solving your question :)
By: admin