javascript Angular.js 框架的额外 js 文件有什么用?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12003019/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 15:01:35  来源:igfitidea点击:

What are the additional js files of the Angular.js framework for?

javascriptangularjs

提问by Luciano Fiandesio

I'm trying out angular.jsand I'm confused by the number of javascript files that I should import. In the 1.0.1 release there are a bunch of additional files such as:

我正在尝试angular.js,但我对应该导入的 javascript 文件的数量感到困惑。在 1.0.1 版本中有一堆附加文件,例如:

  • angular-bootstrap-1.0.1.js
  • angular-loader-1.0.1.js
  • angular-resource-1.0.1.js
  • angular-sanitize-1.0.1.js
  • 角度引导-1.0.1.js
  • angular-loader-1.0.1.js
  • angular-resource-1.0.1.js
  • angular-sanitize-1.0.1.js

Naturally I have opened these files to try to understand what is their function. For instance, angular-loader has a comment that says:

当然,我打开了这些文件,试图了解它们的功能。例如,angular-loader 有一条评论说:

Interface for configuring angular {@link angular.module modules}.

To me, it sounds like an important module, but my simple app works ok without it...

对我来说,这听起来像是一个重要的模块,但我的简单应用程序没有它也能正常工作......

Shall I import all of them?

我要全部导入吗?

回答by Artem Andreev

Disclaimer: it is my thoughts. I am not core developer.

免责声明:这是我的想法。我不是核心开发人员。

AngularJS has base ng module (angular-1.0.1.js) which all basically use and some add-on modules. If you look at the api documentationyou will see that the table of contents on the left side is divided into blocks: ng module, ngMock module, ngCookies module, etc.

AngularJS 有基本的 ng 模块 (angular-1.0.1.js) 和一些附加模块。如果查看api文档,您会看到左侧的目录分为多个块:ng模块、ngMock模块、ngCookies模块等。

angular-bootstrap-1.0.1.js seems as bootstrap-like implementations of dropdown and tabs. I think they are mainly used on angularjs.org. But can be used by anyone (thanks to the MIT license).

angular-bootstrap-1.0.1.js 似乎是下拉菜单和选项卡的类似引导程序的实现。我认为它们主要用于angularjs.org。但任何人都可以使用(感谢 MIT 许可证)。

angular-cookies-1.0.1.js is ngCookies modulewhich provide two services: $cookiesand $cookieStore.

angular-cookies-1.0.1.js 是ngCookies 模块,它提供两种服务:$cookies$cookieStore

angular-loader-1.0.1.js as far as I understand should help to setup angular (ensure that all required modules loaded, etc) in external environments.

据我所知,angular-loader-1.0.1.js 应该有助于在外部环境中设置 angular(确保加载所有必需的模块等)。

angular-resource-1.0.1.js is ngResource modulewhich provide $resource service.

angular-resource-1.0.1.js 是提供$resource 服务的ngResource 模块

angular-sanitize-1.0.1.js is ngSanitize modulewhich provide ngBindHtml directive, linky filterand $sanitize service.

angular-sanitize-1.0.1.js 是ngSanitize 模块,提供ngBindHtml 指令链接过滤器$sanitize 服务

回答by afarazit

Here be the official answer to your question http://docs.angularjs.org/misc/downloading

这是您问题的官方答案http://docs.angularjs.org/misc/downloading