{"id":2459,"date":"2017-04-10T11:40:50","date_gmt":"2017-04-10T09:40:50","guid":{"rendered":"https:\/\/www.angulararchitects.io\/?p=2459"},"modified":"2017-04-10T11:40:50","modified_gmt":"2017-04-10T09:40:50","slug":"using-ngupgrade-with-angulars-aot-compiler","status":"publish","type":"post","link":"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/","title":{"rendered":"Using NgUpgrade With Angular&#8217;s AOT Compiler"},"content":{"rendered":"<div class=\"article\">\n<p><b>Update in December 2016<\/b>: Added some information like downgrading an component with bindings.<\/p>\n<p>ngUpgrade which is included in Angular 2+ (hereinafter just called Angular) allows for the creation of hybrid applications that contains both, AngularJS 1.x based and Angular 2+ based services and components. This helps to migrate an existing AngularJS 1.x application to Angular 2+ step by step. The downside of this approach is that an application needs to load both versions of Angular.<\/p>\n<p>Fortunately, beginning with Angular 2.2.0 which came out in mid-November 2016, there is an implementation of ngUpgrade that allows for ahead of time compilation (AOT). That means that the size of the Angular part can be reduced to the constructs of the framework that are needed by using tree shaking.<\/p>\n<p>In this post, I'm showing how to use this implementation by an example I've prepared for ngEurope. It contains several components and services written with AngularJS 1.x and Angular:<\/p>\n<p><a href=\"https:\/\/camo.githubusercontent.com\/d4939e4ca2ac7589044b1a29eab99777703309e6\/687474703a2f2f692e696d6775722e636f6d2f326b72505735362e706e67\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/camo.githubusercontent.com\/d4939e4ca2ac7589044b1a29eab99777703309e6\/687474703a2f2f692e696d6775722e636f6d2f326b72505735362e706e67\" alt=\"Demo Application\" data-canonical-src=\"http:\/\/i.imgur.com\/2krPW56.png\" style=\"max-width:100%;\"><\/a><\/p>\n<p>While a hybrid application is always bootstrapped as an AngularJS 1.x application, it can contain services and components written with both versions. To use an AngularJS 1.x building block (component or service) within an Angular building block, it needs to be upgraded. This means that it gets a wrapper that makes it look like an Angular component or service. For using an Angular building block within AngularJS 1.x it needs to get downgraded. This also means that a wrapper is generated. In this case, this wrapper makes it look like an AngularJX 1.x counterpart. The following picture demonstrates this. The arrows show whether the respective building block is up- or downgraded:<\/p>\n<p><a href=\"https:\/\/camo.githubusercontent.com\/445b310978936e796b4edb301b29893a45e981cc\/687474703a2f2f692e696d6775722e636f6d2f715746577239382e706e67\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/camo.githubusercontent.com\/445b310978936e796b4edb301b29893a45e981cc\/687474703a2f2f692e696d6775722e636f6d2f715746577239382e706e67\" alt=\"Up- and Downgrading Components and Services\" data-canonical-src=\"http:\/\/i.imgur.com\/qWFWr98.png\" style=\"max-width:100%;\"><\/a><\/p>\n<p>The <a href=\"https:\/\/github.com\/manfredsteyer\/ngUpgrade-aot-sample\">full sample<\/a> used here can be found at <a href=\"https:\/\/github.com\/manfredsteyer\/ngUpgrade-aot-sample\">github<\/a>.<\/p>\n<h2>Downgrading an Angular Component to AngularJS 1.x<\/h2>\n<p>To downgrade an Angular Component to AngularJS 1.x, the sample uses the new method <code>downgradeComponent<\/code> that is located in the module <code>@angular\/upgrade\/static<\/code>. The result of this method can be registered as a directive with an AngularJS 1.x module:<\/p>\n<pre><code>import { downgradeComponent } from '@angular\/upgrade\/static';\n\nvar app = angular.module('flight-app', [...]);\n\n[...]\n\napp.directive('flightSearch', &lt;any&gt;downgradeComponent({ component: FlightSearchComponent }));\n<\/code><\/pre>\n<p>After this, the AngularJS 1.x part of the hybrid application can use this directive. The sample presented here uses it for instance within a template for a route:<\/p>\n<pre><code>$stateProvider\n    [...]\n    .state('flightBooking.flightSearch', {\n        url: '\/flight',\n        template: '&lt;flight-search&gt;&lt;\/flight-search&gt;'\n    });\n<\/code><\/pre>\n<p>As this downgraded component is an Angular component, it has to be registered within an Angular-Module too.<\/p>\n<pre><code>@NgModule({\n    imports: [\n        BrowserModule,\n        HttpModule,\n        FormsModule,\n        UpgradeModule\n    ],\n    declarations: [\n        FlightSearchComponent\n    ],\n    entryComponents: [\n        FlightSearchComponent\n    ]\n})\nexport class AppModule {\n    ngDoBootstrap() {}\n}\n<\/code><\/pre>\n<p>This module has to import the <code>UpgradeModule<\/code>. As it provides Angular building blocks for an application that is bootstrapped with AngularJS 1.x, it does not contain own root components. However, it needs to be bootstrapped too and to make Angular to bootstrap a module without at least one top level component, the module class needs to have an <code>ngDoBootstrap<\/code> method. Here it is vital, to define the <code>FlightSearchComponent<\/code> as an entry component so that the Angular Compiler creates the needed files.<\/p>\n<h2>Downgrading an Angular Component with Bindings to AngularJS 1.x<\/h2>\n<p>When downgrading an Angular Component with Bindings, the application has to pass the names of the inputs and outputs:<\/p>\n<pre><code>app.directive('passengerCard', &lt;any&gt;downgradeComponent({\n                                        component: PassengerCardComponent,\n                                        inputs: ['item', 'selectedItem'],\n                                        outputs: ['selectedItemChange']\n                                }));\n<\/code><\/pre>\n<p>In addition to that, the components has to be registered with the Angular Module:<\/p>\n<pre><code>@NgModule({\n    imports: [\n        BrowserModule,\n        HttpModule,\n        FormsModule,\n        UpgradeModule\n    ],\n    declarations: [\n        FlightSearchComponent,\n        PassengerCardComponent\n    ],\n    entryComponents: [\n        FlightSearchComponent,\n        PassengerCardComponent\n    ]\n})\nexport class AppModule {\n    ngDoBootstrap() {}\n}\n<\/code><\/pre>\n<p>To use such an downgraded component with AngularJS 1.x, the template has to mark the attributes which are used with property- and event bindings. For this, the application typically uses brackets and parenthesis. Although, this is how Angular marks such attributes the template has to use kebab case like in AnglarJS 1.x applications:<\/p>\n<pre><code>&lt;div ng-repeat=\"p in $ctrl.passenger\" class=\"col-sm-4\" style=\"padding:20px;\"&gt;\n    &lt;passenger-card\n            [item]=\"p\"\n            [selected-item]=\"$ctrl.selectedPassenger\"\n            (selected-item-change)=\"$ctrl.selectedPassenger = $event\"&gt;\n    &lt;\/passenger-card&gt;\n&lt;\/div&gt;\n<\/code><\/pre>\n<h2>Downgrading an Angular Service to AngularJS 1.x<\/h2>\n<p>The procedure to downgrade an Angular service to AngularJS 1.x is similar to the process for downgrading a component: for this, the module <code>@angular\/upgrade\/static<\/code> provides a method <code>&lt;code&gt;@angular\/upgrade\/static&lt;\/code&gt;<\/code>`. Its return value can be registered as an AngularJS 1.x factory:<\/p>\n<pre><code>import { downgradeInjectable } from '@angular\/upgrade\/static';\n\nvar app = angular.module('flight-app', [...]);\n\n[...]\n\napp.factory('passengerService', downgradeInjectable(PassengerService));\n<\/code><\/pre>\n<p>Then, the service can be injected in an AngularJS 1.x building block:<\/p>\n<pre><code>class PassengerSearchController {\n\n    constructor(private passengerService: PassengerService) {\n    }\n\n    [...]\n}\n<\/code><\/pre>\n<p>Here it is important to remember that AngularJS 1.x uses names and not types for injection. Because of this, the presented Controller has to name the constructor argument <code>passengerService<\/code>. The mentioned typed is irrelevant for dependency injection.<\/p>\n<p>Again, as the <code>PassengerService<\/code> is an Angular Service it has be registered with an Angular Module:<\/p>\n<pre><code>@NgModule({\n    imports: [\n        BrowserModule,\n        HttpModule,\n        FormsModule,\n        UpgradeModule\n    ],\n    declarations: [\n        FlightSearchComponent\n    ],\n    entryComponents: [\n        FlightSearchComponent\n    ],\n    providers: [\n        PassengerService\n    ]\n})\nexport class AppModule {\n    ngDoBootstrap() {}\n}\n<\/code><\/pre>\n<h2>Upgrading an AngularJS 1.x Component to Angular<\/h2>\n<p>Upgrading an AngularJS 1.x component to Angular is a bit more complicated. In this case, the application has to provide a wrapper for the upgraded component by subclassing <code>UpgradeComponent<\/code>:<\/p>\n<pre><code>import {UpgradeComponent} from \"@angular\/upgrade\/static\";\n[...]\n\n@Directive({selector: 'flight-card'})\nexport class FlightCard extends UpgradeComponent implements OnInit, OnChanges {\n\n    @Input() item: Flight;\n    @Input() selectedItem: Flight;\n    @Output() selectedItemChange: EventEmitter&lt;any&gt;;\n\n    constructor(elementRef: ElementRef, injector: Injector) {\n        super('flightCard', elementRef, injector);\n    }\n\n    ngOnInit() { return super.ngOnInit(); }\n    ngOnChanges(c) { return super.ngOnChanges(c); }\n\n}\n<\/code><\/pre>\n<p>Unfortunately, this cannot be moved to a convenience function because it would prevent the compiler from finding the required metadata. The wrapper needs to have an input for each ingoing property of the AngularJS 1.x component and an output    for each event. ngUpgrade will connect them to the respective counterparts in the AngularJS 1.x component. To tell ngUprade which AngularJS 1.x component to wrap, the constructor has to delegate its canonical name to the base constructor using <code>super<\/code>. In addition, <code>super<\/code> also needs an instance of <code>ElementRef<\/code> and <code>Injector<\/code> that can be obtained via dependeny injection.<\/p>\n<p>In addition to that, the wrapper needs to implement life cycle hooks which are relevant for the AngularJS 1.x component. In any case, it needs to implement <code>ngOnInit<\/code> because <code>ngUpgrade<\/code> is picking up this method via reflection and using it to instantiate the wrapped component. Its fully sufficient to just make this method to delegate to the base implementation. To support data binding, the wrapper needs to have an <code>ngOnChanges<\/code> method for the same reason.<\/p>\n<p>After this, the wrapper can be registered with an Angular 2 module.<\/p>\n<pre><code>import {UpgradeModule} from \"@angular\/upgrade\/static\";\n\n@NgModule({\n    imports: [\n        [...],\n        UpgradeModule\n    ],\n    [...],\n    declarations: [\n        FlightSearchComponent,\n        FlightCard \/\/ &lt;-- Upgraded Component\n    ],\n    [...]\n})\nexport class AppModule {\n    ngDoBootstrap() {}\n}\n<\/code><\/pre>\n<p>After registering the wrapper, it can be used in the template of other Angular components:<\/p>\n<pre><code>&lt;flight-card\n        [item]=\"f\"\n        [selectedItem]=\"selectedFlight\"\n        (selectedItemChange)=\"selectedFlight = $event\"&gt;&lt;\/flight-card&gt;\n<\/code><\/pre>\n<h2>Upgrading an AngularJS 1.x Service to Angular<\/h2>\n<p>To upgrade an AngularJS 1.x service, the application has to to provide a function that takes an AngularJS 1.x injector and uses it to return the service in question:<\/p>\n<pre><code>export function createFlightService(injector) {\n    return injector.get('flightService');\n}\n<\/code><\/pre>\n<p>Again, this cannot be moved to a generic convenience function because this would prevent the AOT from finding the necessary metadata. To use this function in the Angular 2 part of the hybrid application, it is registered as a factory function using a provider:<\/p>\n<pre><code>@NgModule({\n    [...]\n    providers: [\n        PassengerService,\n        {\n            provide: FlightService,\n            useFactory: createFlightService,\n            deps: ['$injector']\n        },\n        [...]\n    ]\n})\nexport class AppModule {\n    ngDoBootstrap() {}\n}\n<\/code><\/pre>\n<p>After this, Angular 2 can inject the service into consumers, e.g. components or services:<\/p>\n<pre><code>@Component({ [...] })\nexport class FlightSearchComponent {\n\n    constructor(\n        private flightService: FlightService, [...]) {\n    }\n\n    [...]\n}\n<\/code><\/pre>\n<h2>Bootstrapping<\/h2>\n<p>To bootstrap an hybrid application, the demo here presented uses a function <code>bootstrap<\/code> that has been \"borrowed\" from the unit tests of ngUpgrade. It bootstraps both, the AngularJS 1.x part as well as the Angular 2 part of the application:<\/p>\n<pre><code>import {PlatformRef, NgModuleFactory} from \"@angular\/core\";\nimport {UpgradeModule} from \"@angular\/upgrade\/static\";\nimport {platformBrowser} from \"@angular\/platform-browser\";\nimport {AppModuleNgFactory} from \"..\/aot\/app\/app2.module.ngfactory\";\n\n\/\/ bootstrap function \"borrowed\" from the angular test cases\nexport function bootstrap(\n    platform: PlatformRef, Ng2Module: NgModuleFactory&lt;{}&gt;, element: Element, ng1ModuleName: string) {\n    \/\/ We bootstrap the Angular 2 module first; then when it is ready (async)\n    \/\/ We bootstrap the Angular 1 module on the bootstrap element\n    return platform.bootstrapModuleFactory(Ng2Module).then(ref =&gt; {\n        let upgrade = ref.injector.get(UpgradeModule) as UpgradeModule;\n        upgrade.bootstrap(element, [ng1ModuleName]);\n        return upgrade;\n    });\n}\n\nbootstrap(\n    platformBrowser(),\n    AppModuleNgFactory,\n    document.body,\n    'flight-app')\n    .catch(err =&gt; console.error(err));\n<\/code><\/pre>\n<blockquote><p>\nPlease note, that AppModuleNgFactory is generated by the AOT Compiler. This is described in the next sections. Before this file has been generated, you could use <code>null<\/code> as a placeholder to avoid compilation errors.\n<\/p><\/blockquote>\n<p>Here it is important to note, that the AngularJS 1.x module is bootstrapped with the <code>UpgradeModule's<\/code> bootstrap method. This is a replacement for <code>ng-app<\/code> or <code>angular.bootstrap<\/code>. The passed <code>NgModuleFactory<\/code> is created by the AOT compiler when compiling the Angular 2 module.<\/p>\n<h2>AOT Compilation<\/h2>\n<p>To use the AOT compiler, the application should provide an (additional) <code>tsconfig.json<\/code>. This file is called <code>tsconfig.aot.json<\/code> in this sample. It contains an <code>angularCompilerOptions<\/code> property which tells the compiler where to place the generated files.<\/p>\n<pre><code>{\n    \"compilerOptions\": {\n        \"target\": \"es5\",\n        \"module\": \"es2015\",\n        \"moduleResolution\": \"node\",\n        \"sourceMap\": true,\n        \"emitDecoratorMetadata\": true,\n        \"experimentalDecorators\": true,\n        \"removeComments\": false,\n        \"noImplicitAny\": false,\n        \"suppressImplicitAnyIndexErrors\": true,\n        \"typeRoots\": [\n            \"typings\/globals\/\"\n        ]\n    },\n\n    \"files\": [\n        \"app\/app2.module.ts\"\n    ],\n\n    \"angularCompilerOptions\": {\n        \"genDir\": \"aot\",\n        \"skipMetadataEmit\" : true\n    }\n}\n<\/code><\/pre>\n<p>To allow tree shaking for optimizing the size of the Angular 2 part, the module pattern <code>es2015<\/code> is choosen. For the compilation and for starting the sample, the file <code>package.json<\/code> defines some scripts. The most important one here is <code>ngc<\/code> which is starting the AOT compiler and passing the file <code>tsconfig.aot.json<\/code>:<\/p>\n<pre><code>[...]\n\"scripts\": {\n\"webpack\": \"webpack\",\n\"server\": \"live-server\",\n\"start\": \"npm run server\",\n\"ngc\": \"ngc -p tsconfig.aot.json\",\n\"build\": \"npm run ngc &amp;&amp; npm run webpack\"\n},\n[...]\n<\/code><\/pre>\n<p>This sample also uses webpack for bundling, which is executed after the AOT compiler by the script <code>build<\/code>. To make this work, one needs to download the package <code>@angular\/compiler-cli<\/code>. The <code>start<\/code> script calls the <code>live-server<\/code> and not the <code>webpack-dev-server<\/code> because the latter has not fully supported the AOT compiler for recompiling when this text was written.<\/p>\n<h2>Build and Starting the Application<\/h2>\n<p>To build and start the application described here, the following commands can be used:<\/p>\n<pre><code>npm run build\nnpm start\n<\/code><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>To Optimize Performance<\/p>\n","protected":false},"author":9,"featured_media":2997,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":"[]","_tribe_ticket_has_attendee_info_fields":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2459","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-unkategorisiert"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Using NgUpgrade With Angular&#039;s AOT Compiler - ANGULARarchitects<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using NgUpgrade With Angular&#039;s AOT Compiler - ANGULARarchitects\" \/>\n<meta property=\"og:description\" content=\"To Optimize Performance\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/\" \/>\n<meta property=\"og:site_name\" content=\"ANGULARarchitects\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-10T09:40:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2019\/04\/blog-2355684-1280.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"853\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Manfred Steyer, GDE\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@daniel\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Manfred Steyer, GDE\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/\"},\"author\":{\"name\":\"Manfred Steyer, GDE\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/15628efa7af4475ffaaeeb26c5112951\"},\"headline\":\"Using NgUpgrade With Angular&#8217;s AOT Compiler\",\"datePublished\":\"2017-04-10T09:40:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/\"},\"wordCount\":1222,\"publisher\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2019\/04\/blog-2355684-1280.jpg\",\"articleSection\":[\"Unkategorisiert\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/\",\"url\":\"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/\",\"name\":\"Using NgUpgrade With Angular's AOT Compiler - ANGULARarchitects\",\"isPartOf\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2019\/04\/blog-2355684-1280.jpg\",\"datePublished\":\"2017-04-10T09:40:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/#primaryimage\",\"url\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2019\/04\/blog-2355684-1280.jpg\",\"contentUrl\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2019\/04\/blog-2355684-1280.jpg\",\"width\":1280,\"height\":853},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.angulararchitects.io\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using NgUpgrade With Angular&#8217;s AOT Compiler\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#website\",\"url\":\"https:\/\/www.angulararchitects.io\/en\/\",\"name\":\"ANGULARarchitects\",\"description\":\"AngularArchitects.io\",\"publisher\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.angulararchitects.io\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#organization\",\"name\":\"ANGULARarchitects\",\"alternateName\":\"SOFTWAREarchitects\",\"url\":\"https:\/\/www.angulararchitects.io\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2023\/07\/AA-Logo-RGB-horizontal-inside-knowledge-black.svg\",\"contentUrl\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2023\/07\/AA-Logo-RGB-horizontal-inside-knowledge-black.svg\",\"width\":644,\"height\":216,\"caption\":\"ANGULARarchitects\"},\"image\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/github.com\/angular-architects\",\"https:\/\/www.linkedin.com\/company\/angular-architects\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/15628efa7af4475ffaaeeb26c5112951\",\"name\":\"Manfred Steyer, GDE\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a0b59539674d8b71ea1c1f4764b11244b5f499203f1d11b40f37d8f3f90be033?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a0b59539674d8b71ea1c1f4764b11244b5f499203f1d11b40f37d8f3f90be033?s=96&d=mm&r=g\",\"caption\":\"Manfred Steyer, GDE\"},\"sameAs\":[\"https:\/\/x.com\/daniel\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using NgUpgrade With Angular's AOT Compiler - ANGULARarchitects","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/","og_locale":"en_US","og_type":"article","og_title":"Using NgUpgrade With Angular's AOT Compiler - ANGULARarchitects","og_description":"To Optimize Performance","og_url":"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/","og_site_name":"ANGULARarchitects","article_published_time":"2017-04-10T09:40:50+00:00","og_image":[{"width":1280,"height":853,"url":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2019\/04\/blog-2355684-1280.jpg","type":"image\/jpeg"}],"author":"Manfred Steyer, GDE","twitter_card":"summary_large_image","twitter_creator":"@daniel","twitter_misc":{"Written by":"Manfred Steyer, GDE","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/#article","isPartOf":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/"},"author":{"name":"Manfred Steyer, GDE","@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/15628efa7af4475ffaaeeb26c5112951"},"headline":"Using NgUpgrade With Angular&#8217;s AOT Compiler","datePublished":"2017-04-10T09:40:50+00:00","mainEntityOfPage":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/"},"wordCount":1222,"publisher":{"@id":"https:\/\/www.angulararchitects.io\/en\/#organization"},"image":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/#primaryimage"},"thumbnailUrl":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2019\/04\/blog-2355684-1280.jpg","articleSection":["Unkategorisiert"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/","url":"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/","name":"Using NgUpgrade With Angular's AOT Compiler - ANGULARarchitects","isPartOf":{"@id":"https:\/\/www.angulararchitects.io\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/#primaryimage"},"image":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/#primaryimage"},"thumbnailUrl":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2019\/04\/blog-2355684-1280.jpg","datePublished":"2017-04-10T09:40:50+00:00","breadcrumb":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/#primaryimage","url":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2019\/04\/blog-2355684-1280.jpg","contentUrl":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2019\/04\/blog-2355684-1280.jpg","width":1280,"height":853},{"@type":"BreadcrumbList","@id":"https:\/\/www.angulararchitects.io\/en\/blog\/using-ngupgrade-with-angulars-aot-compiler\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.angulararchitects.io\/en\/"},{"@type":"ListItem","position":2,"name":"Using NgUpgrade With Angular&#8217;s AOT Compiler"}]},{"@type":"WebSite","@id":"https:\/\/www.angulararchitects.io\/en\/#website","url":"https:\/\/www.angulararchitects.io\/en\/","name":"ANGULARarchitects","description":"AngularArchitects.io","publisher":{"@id":"https:\/\/www.angulararchitects.io\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.angulararchitects.io\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.angulararchitects.io\/en\/#organization","name":"ANGULARarchitects","alternateName":"SOFTWAREarchitects","url":"https:\/\/www.angulararchitects.io\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2023\/07\/AA-Logo-RGB-horizontal-inside-knowledge-black.svg","contentUrl":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2023\/07\/AA-Logo-RGB-horizontal-inside-knowledge-black.svg","width":644,"height":216,"caption":"ANGULARarchitects"},"image":{"@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/github.com\/angular-architects","https:\/\/www.linkedin.com\/company\/angular-architects\/"]},{"@type":"Person","@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/15628efa7af4475ffaaeeb26c5112951","name":"Manfred Steyer, GDE","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a0b59539674d8b71ea1c1f4764b11244b5f499203f1d11b40f37d8f3f90be033?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a0b59539674d8b71ea1c1f4764b11244b5f499203f1d11b40f37d8f3f90be033?s=96&d=mm&r=g","caption":"Manfred Steyer, GDE"},"sameAs":["https:\/\/x.com\/daniel"]}]}},"_links":{"self":[{"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/posts\/2459","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/comments?post=2459"}],"version-history":[{"count":0,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/posts\/2459\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/media\/2997"}],"wp:attachment":[{"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/media?parent=2459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/categories?post=2459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/tags?post=2459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}