Articles for August 2016

Yes, I Used jQuery in My Angular2 Application

An astute observer has probably noticed that I’m using jQuery in my Angular2 example application. “The horror! Revoke his Angular2 license now!!” I’m in no way saying this is a best practice or even a good practice. Including jQuery is not required or even desirable for most Angular2 applications. Angular1 had a dependency on jQuery or its own jQuery-lite version, but for Angular2 this is no longer the case. jQuery will also cause problems for other scenarios, like pre-rendering the Angular2 application on the server or in a web worker, because jQuery components are expecting to work with the physical DOM. Plus it weights your application down with additional dependencies that will cause the application to load more slowly for a user. But using jQuery was practical for this situation and gives me the chance to demonstrate how Angular2 can interoperate with existing web technologies. Let’s take a step back and look why jQuery might be worth considering in certain scenarios. User Interface Widgets There’s been much discussion about creating general purpose user interface components (commonly called “widgets”). Think of widgets as resuable pieces of user interface that can help you to build your application, for example, a progress bar, Read More

Source: Yes, I Used jQuery in My Angular2 Application – Wintellect DevCenter

Ahead of Time Compilation in Angular 2.0

In this article I will show how to use the ahead of time compiler (AOT) in Angular 2 to improve performance.

Before our application can be rendered, the browsers has to do a fair amount of processing to convert all the Angular specific syntax to regular JavaScript. This process of evaluating binding expressions and parsing templates is called compilation.

As part of compilation, html templates are converted to executable JavaScript that the browser will execute to render the application.

Source: Ahead of Time Compilation in Angular 2.0

Angular Modules (NgModule) 

Angular Modules help organize an application into cohesive blocks of functionality.

An Angular Module class is adorned with the NgModule decorator that defines metadata about the module.

This chapter explains how to create NgModule classes and how to load them, either immediately when the application launches or later, as needed, via the Router.

Source: Angular Modules (NgModule) – ts