How to install Angular JS modules?

Asked

Viewed 1,312 times

1

I am creating an application in spring + angular , and for reasons I am not able to install the angular modules in the project folder by the command Bower install... I can install this module manually and how to use it?

  • Make sure the Bower module folder is being "served" by Spring

3 answers

2

You have to give the include of the js module in your application and then pass the dependency on your app, example:

In html:

<script src="angular-route.js">

In its main module:

angular.module('app', ['ngRoute']);

1

The way to "install an Angularjs module" using Node.js (Bower is a Node.js middleware), is to use Bower install or npm install.

However, as you are not getting it this way the other way is to do it manually, ie, download the JS file from the Angular module and import the script into your HTML and your Angular app.

Ex:

Download the module: angular-filter

Include in your HTML:

<script src="angular-filter.js">

Then add the module at the angle:

angular.module("app", ["angular.filter"]);

1


On the Angularjs page, click the button Download and then in Browse addicional modules. A list of module files will appear, click on the module file you want to add, copy the link and add from the references. I’ll take the example AngularRoute, can be another. Can be the normal development version or minified for the production mode.

<script src="https://code.angularjs.org/1.4.5/angular-route.js" />

You should also add dependencies to the main module or module that will use the dependency as already mentioned:

angular.module('app', ['ngRoute']);

This way you won’t need to touch your local folder or use Bower. The files will be stored in your browser’s cache. But if possible, you can also download to your machine as mentioned above.

  • 1

    vlw man! I got it here

  • @Robertooliveira if it worked for you, mark the Shura16 answer as accepted - so other users interested in the same subject will know that your question has received a valid solution. Hugs!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.