简体   繁体   English

Angular 2的第三方模块系统

[英]3rd Party module system for Angular 2

Following the official guide of Angular 2 with JavaScript (not TypeScript), at the beginning of the guide, under the "Modules" sub-heading, it is written that: 遵循Angular 2 with JavaScript(而非TypeScript)的官方指南 ,在该指南的开头,“模块”子标题下写道:

"ES5 JavaScript doesn't have a native module system. There are several popular 3rd party module systems we could use. Instead, for simplicity and to avoid picking favorites, we'll create a single global namespace for our application." “ ES5 JavaScript没有本地模块系统。我们可以使用几种流行的第三方模块系统。相反,为了简单起见并避免选择任何收藏夹,我们将为应用程序创建一个全局名称空间。”

and the code for a basic application is this: 基本应用程序的代码是这样的:

(function(app) {
  app.AppComponent =
    ng.core.Component({
      selector: 'my-app',
      template: '<h1>My First Angular 2 App</h1>'
    })
    .Class({
      constructor: function() {}
    });
})(window.app || (window.app = {}));

Since I'm not a professional JavaScript coder, I wonder how we can use a 3rd party module system instead of (function(app){})(); 由于我不是专业的JavaScript程序员,所以我想知道如何使用第三方模块系统代替(function(app){})(); (or not instead of?) (或者不是?)
Give me some examples of 3rd party module system with this code modified, please. 请给我一些修改了此代码的第三方模块系统的示例。 Thanks in advance. 提前致谢。

you can refer to the demo 你可以参考演示

and also view this question 并查看这个问题

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

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