angular.dev.js和angular.sfx.dev.js的区别 [英] Difference between angular.dev.js and angular.sfx.dev.js

查看:220
本文介绍了angular.dev.js和angular.sfx.dev.js的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能解释在 HTTPS在角2 alpha版本这两个文件之间的差异:// code.angularjs.org / 2.0.0-alpha.20

从查看源$ C ​​$ C,似乎在sfx.dev.js的global.System对象被覆盖,具有进口和配置功能删除。

From looking at the source code, it seems that in sfx.dev.js the global.System object is overwritten, having the 'import' and 'config' functions removed.

推荐答案

这就是所谓的 自执行捆绑 。查看<一个href=\"https://github.com/angular/angular/blob/705d3aacff4005483f8ecbff5fc2d484b3e38cf5/gulpfile.js#L693\">this评论。它说:

This is so called Self-Executing bundle. Check out this comment. It says:

这束执行其主要模块 - angular2_sfx,加载时,没有相应System.import电话。其目的是在不使用系统加载程序polyfills(如system.js和ES6装载机)ES5的开发者。

This bundle executes its main module - angular2_sfx, when loaded, without a corresponding System.import call. It is aimed at ES5 developers that do not use System loader polyfills (like system.js and es6 loader).

所以,你不需要System.js添加到项目中。毗邻行添加到您的html页面:

So you don't need to add System.js to your project. Just add next lines to your html page:

<script src="https://code.angularjs.org/2.0.0-alpha.20/angular2.sfx.dev.js"></script>
<script src="app.js"></script>
<script>
  document.addEventListener('DOMContentLoaded', function() {
    angular.bootstrap(App);
  });
</script>

下面是 plunker 以展示它是如何工作的。

Here is plunker to show how it works.

这篇关于angular.dev.js和angular.sfx.dev.js的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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