Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript npm安装angularjs,然后在我的应用程序中需要angularjs_Javascript_Angularjs_Npm - Fatal编程技术网

Javascript npm安装angularjs,然后在我的应用程序中需要angularjs

Javascript npm安装angularjs,然后在我的应用程序中需要angularjs,javascript,angularjs,npm,Javascript,Angularjs,Npm,我想做的是非常基本的。我想使用npm安装AngularJS v1.5.x,然后在我的应用程序中使用它。我看到的所有教程都是从angularjs.org下载Angular版本,然后将其包含在index.html标签中。但是我想使用npm来安装AngularJS,然后让它像真正的开发人员一样在我的index.html中使用 以下是我运行的命令 $ npm init $ npm install angular@1.5.7 --save npm-angular-test@1.0.0 /Users/the

我想做的是非常基本的。我想使用npm安装AngularJS v1.5.x,然后在我的应用程序中使用它。我看到的所有教程都是从angularjs.org下载Angular版本,然后将其包含在
index.html
标签中。但是我想使用npm来安装AngularJS,然后让它像真正的开发人员一样在我的
index.html
中使用

以下是我运行的命令

$ 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
这是我的基本
包.json

{
  "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"
}
我创建了一个
index.js
,但我将其留空。然后,我在
index.html
中添加了一个src标记,以包括
index.js

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

Html
我的第一个表达式:{{5+5}


我的表达式只是写
{{5+5}}
而不是
10
。我错在哪里了?

包括Angular.js via

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

虽然我使用bower,但检查angularJS文件在通过npm安装后的位置

或使用


npm只是存储库中前端库的一些管理器,不用于将其包含到webapp中,也不包括Angular.js

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

虽然我使用bower,但检查angularJS文件在通过npm安装后的位置

或使用

npm只是存储库中前端库的一些管理器,不用于将其包含到webapp中,在本例中“/node\u modules/somefile.js”应该是“/node\u modules/angular/angular.js”(或使用bower时“/bower\u components/angular/angular.js”),在本例中“/node\u modules/somefile.js”应该是“/node_modules/angular/angular.js”(或使用bower时的“/bower_components/angular/angular.js”)