The easiest way to create and work on an Ionic project is to use the Ionic CLI.
However Ionic 2 is based on Angular 2, so we could say that an Ionic project is basically an Angular project with the Ionic framework added to it. You don’t have to use the Ionic CLI.
Ionic “the framework” is one thing, and the Ionic CLI is another thing. This is an important distinction that people just starting with Ionic frequently seem to miss.
In this article I am going to explain how to enable Angular 2 Ahead-of-Time (AoT) template compilation with Webpack 2, using the
Ahead-of-Time (AoT, also called “offline”) template compilation results in smaller application code size and faster initial rendering compared to Just-in-Time (JiT, also called “dynamic”) template compilation. If you’d like more details on those two options have a look a the Angular documentation. Also, Tobias Bosch in this Angular 2 Compiler talk gave a very interesting explanation of why the AoT compiler was introduced.
In this first part we see how to write a first Angular 2 Component, and introduce the concepts of Template, Metadata, HTML Plus, and the bootstrap method.
You can download the starting project mentioned in the video here: hello-world-0.zip
Interested in my upcoming full course on Angular 2? Pre-register here.
With Angular 2 now in beta, it’s definitely time to start playing with it. One of my first questions was: what language to use? The first example in the Angular 2 website says
While this example uses TypeScript, Angular works equally well with ES5, ES6 and Dart as well.
So, is it actually possible to write Angular 2 components in “pure” ES6, with code similar to the TypeScript examples but without types and decorators?