Angular 2 Output Properties

Outputs The Output decorator allows components to raise custom events and notify consumers of a change in state. To accomplish this in Angular 2, we rely on an EventEmmitter to publish the event. In our previous example, our FavoriteComponent allowed us to favorite/unfavorite. This worked well for an example, but wasn’t practical. In a real-world…

Angular 2 Decorators

In Angular 2, decorators allow you to add metadata to a class using annotations. The most common decorators are the @Component and @Injectable. Decorators add metadata to a class in order to give it meaning; they are a declarative way to add metadata to code Let’s take a look at the class below.

This…

Angular 2 Modules

Angular 2 Modules are a fundamental part of angular applications. Applications that are built to scale are broken up into separate units, Angular 2 calls these units modules. The module exposes a few pieces of functionality and hide the implementation details from the consumer. Let’s think of a coffee machine for a minute. Looking at…

Angular 2 Input Properties

In order for components that we write to be useful in our applications they need to be initialized with data (either from the user or a server). For example, if we were going to create a favorite component we need to pass in the current state of the item (whether it has or has not…

Ionic 2 LocalStorage

Ionic 2 has re-invented the way mobile apps store data. Storage allows your app to store key/value pairs, where the value can be a simple string or a complex JSON object. Ionic 2 supports different types of storage: SQLite (this will require the sql lite cordova plugin), IndexdDB, WEBSQL, and localstorage in that order. It’s…

Ionic 2 Http Request & Services

Making an http request in Ionic 2 can be done in one of two ways, using an observable or a promise. There are many articles that explain the differences quite well, so we’re not going to get into the pros and cons of each. Instead, we are going to make a promise-based

Starting an Ionic 2 App

This blog post will be the first of a short series where we build a simple Ionic 2 application. The app will allow us to send a search term to an API and then show the results. We are going to start an Ionic 2 application, go through the Ionic 2’s app structure, and understand…

Ionic 2 Start Error

When starting a new Ionic 2 app, you may encounter a peculiar error which tells you that npm install could not be found, followed by some gibberish.

Ionic 2 Camera Example

In this example we are going to show how to use ionic-native’s Camera plugin to take a picture using the camera. This example assumes that you have an ionic 2 project up and running, although these examples are in typescript, it should not be very difficult to adapt this example to run in plain old…