简体   繁体   中英

how to install a module with npm in angular 1

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

只需从<script src="/node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js"></script>删除/像这样:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM