Angular 2自举选项-AOT与JIT [英] Angular 2 Bootstrapping Options - AOT vs JIT
本文介绍了Angular 2自举选项-AOT与JIT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
只是从Angular 2开始.
Just kick started with Angular 2.
-
angular 2中有哪些不同的Bootstrapping选项?
What are the various Bootstrapping options in angular 2?
为什么当我进行更改并刷新index.html时才花费很少的时间来检索HTML标记?
Why is that when I make a change and refresh the index.html takes little time to retrieve the HTML markups?
它们之间的区别
推荐答案
有两个选项
-
动态引导
Dynamic bootstrapping
- 编译器使用了 JIT (及时).
- 在浏览器中动态编译ts文件.
- 这就是index.html花很少的时间来检索标记的原因.
-
main.ts包含以下
- compiler used JIT (Just in Time).
- dynamically compiles the ts files in the browser.
- this is the reason the index.html takes little time to retrieve the markups.
main.ts contains the following
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);
- 静态引导
main.ts包含以下
main.ts contains the following
import { platformBrowser } from '@angular/platform-browser';
import { AppModuleNgFactory } from '../aot/app/app.module.ngfactory';
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
差异
这篇关于Angular 2自举选项-AOT与JIT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文