Creating a TypeScript “non-enumerable” property decorator

Creating a TypeScript “non-enumerable” property decorator

TypeScript
Creating a TypeScript "non-enumerable" property decorator This post explains how to create a TypeScript property decorator that allows hiding a class property in enumerators. If you are new to TypeScript or it's decorators, you might start here first. Why should I be able to exclude a class property from being enumerated Well, one good reason is to exclude the property from being included in the JSON representation of the class instance. For example, let's look at a simple class: [crayon-5a3780c73c921238027011/] Now let's look at the JSON representation of a class instance: [crayon-5a3780c73c92c794588470/] This will print [crayon-5a3780c73c92f064028784/] OK, so we do not want our password to be serialized in our JSON. Let's create a decorator to prevent this. Creating the decorator Put the following code into a TypeScript file. [crayon-5a3780c73c932696723862/] Make…
Read More
Angular 2 TODO List example

Angular 2 TODO List example

Angular 2, AngularJS, JavaScript, TypeScript
How to create a TODO list in Angular 2 There are a lot of examples on how to create a TODO List in Angular 2 on the web, but lots of them use outdated versions. Most of these examples use Alpha, Beta and RC versions. The problem is that they are already outdated and no longer compatible with the most recent version of Angular 2. The following example uses the 2.2.1 version. This is the most recent version at the time of writing. https://github.com/resolvethis/ng2-todo This example contains the basics about Creating components Communicating between components Creating routes Clone or download the sample code from github and start playing with the example. Check back soon for more details and explanation on this example.
Read More