thedanotto thedanotto - 1 year ago 91
AngularJS Question

npm to install angularjs, then require angularjs in my application

What I want to do is very basic. I want to install AngularJS v1.5.x using npm and then have it available for me to utilize within my application. All the tutorials I see out there are just downloading the Angular Version from then including it in their

in a
tag. But I want to use npm to install AngularJS and then make it available for me to use within my
like a real developer might do!

Here are the commands I've run.

$ npm init
$ npm install angular@1.5.7 --save
npm-angular-test@1.0.0 /Users/theDanOtto/Sites/Playground/npm-angular-test
└── angular@1.5.7

Here is my basic

"name": "npm-angular-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"angular": "^1.5.7"
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"author": "",
"license": "ISC"

I created an
, but I left it blank. I then added a src tag in my
to include

<!DOCTYPE html>
<html ng-app>
<script src="index.js"></script>
<p>My first expression: {{ 5 + 5 }}</p>

My expression simply writes
{{ 5 + 5 }}
instead of
. Where am I headed wrong?

f7o f7o
Answer Source

Either include Angular.js via

<script type="text/javascript" src="node_modules/somefile.js"></script>

though i use bower, check were angularJS file is located after installing it via npm

or use requireJS

npm is only some manager for frontend libraries in your repository, not for including it into the webapp

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download