angular 2模块和Javascript ES6模块之间的区别 [英] Difference between angular 2 modules and Javascript ES6 modules

查看:100
本文介绍了angular 2模块和Javascript ES6模块之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Angular 2模块允许将应用程序划分为多个模块,每个模块具有不同的用途.

Angular 2 modules allow apps to be divided into multiple modules, each serving a different purpose.

但是ES6模块也不应该做什么吗?两者有什么区别?

But isn't that what ES6 modules also supposed to do? What is the difference between the two?

推荐答案

来自angular.io:

Taken from angular.io:

Angular模块类与JavaScript模块类在三个主要方面不同:

The Angular module classes differ from JavaScript module class in three key respects:

  1. Angular模块仅限制可声明的类.声明式是唯一与Angular相关的类.

  1. An Angular module bounds declarable classes only. Declarables are the only classes that matter to the Angular.

我们没有在一个巨型文件中定义所有成员类(如在JavaScript模块中一样),而是在@NgModule.declarations列表中列出了该模块的类.

Instead of defining all member classes in one giant file (as in a JavaScript module), we list the module's classes in the @NgModule.declarations list.

这篇关于angular 2模块和Javascript ES6模块之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆