简体   繁体   English

无法加载angularjs库

[英]Unable to load angularjs library

Hi I am developing angularjs application. 嗨,我正在开发angularjs应用程序。 I was using below link to refer angularjs. 我使用下面的链接来引用angularjs。

 <script data-require="angular.js@1.4.5" data-semver="1.4.5" src="https://code.angularjs.org/1.4.5/angular.js"></script>

I am getting below error. 我收到了以下错误。 https://code.angularjs.org/1.4.5/angular.js net::ERR_CONNECTION_TIMED_OUT

suddenly now i am not able to load this library. 突然间我现在无法加载这个库。 Is there any problem with angular site? 有角度的网站有什么问题吗? Anyone else facing this issue? 其他人面临这个问题? Thank you. 谢谢。

Its always better to use bower and install the library which you want to use. 最好使用凉亭并安装您想要使用的库。

Use some package manager like bower to load your dependencies. 使用像bower这样的包管理器来加载依赖项。

Don't rely on the cdn/library url , sometimes they update the url on anytime and it might get timed out. 不要依赖cdn / library url,有时他们会随时更新url并且可能会超时。

The given library link is not working. 给定的库链接不起作用。 Use the below cdn url : https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.js 使用以下cdn网址: https ://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.js

The hosted library is not loading, you can check it by directly accessing https://code.angularjs.org/1.4.5/angular.js 托管库未加载,您可以通过直接访问https://code.angularjs.org/1.4.5/angular.js来检查它。

Use src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js" instead. 请改用src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"

your CDN link is down for some reason. 由于某种原因,您的CDN链接已关闭。 you can use the bellow link. 你可以使用波纹管链接。 It is better not to use the CDN. 最好不要使用CDN。 Try to use the downloaded file instead. 请尝试使用下载的文件。

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.js"></script>

It's better you use a package manager like bower which would help to manage all dependent packages of your project and load them easily. 最好使用像bower这样的包管理器来帮助管理项目的所有依赖包并轻松加载它们。 A simple bower.json example i have provided below. 我在下面提供了一个简单的bower.json示例。 It's better you avoid using online CDN hosted libraries. 最好避免使用在线CDN托管库。

{
  "name": "angular-seed",
  "description": "A starter project for AngularJS",
  "version": "0.0.0",
  "homepage": "https://github.com/angular/angular-seed",
  "license": "MIT",
  "private": true,
  "dependencies": {
    "angular": "~1.5.0",
    "angular-route": "~1.5.0",
    "angular-loader": "~1.5.0",
    "angular-mocks": "~1.5.0",
    "html5-boilerplate": "^5.3.0"
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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