- Install:
- jest:
npm install --save-dev jest - ts-jest:
npm install --save-dev ts-jest @types/jest
- Modify package.json
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest"
| import { Directive, ElementRef, HostListener, Output, EventEmitter } from '@angular/core'; | |
| import { NgControl } from '@angular/forms'; | |
| @Directive({ | |
| selector: '[numeric]' | |
| }) | |
| export class NumericDirective { | |
| @Output() ngModelChange: EventEmitter<any> = new EventEmitter<any>(false); | |
| constructor( |
| /** | |
| * A simple demo on how the new Intersection Observer API can be used to lazy load images. | |
| * https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API | |
| * | |
| * Intersection Observer is available in most modern browsers and there's a decent polyfill, too: | |
| * https://github.com/WICG/IntersectionObserver/tree/gh-pages/polyfill | |
| */ | |
| let imageNodes = []; |
Angular (aka Angular 2) is a new framework completely rewritten from the ground up, replacing the famous AngularJS framework (aka Angular 1.x).
More that just a framework, Angular should now be considered as a whole platform which comes with a complete set of tools, like its own CLI, debug utilities or performance tools.
At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.
git commit --amendThis will open your $EDITOR and let you change the message. Continue with your usual git push origin master.
| import { Pipe, PipeTransform, Injectable } from '@angular/core'; | |
| /** | |
| * | |
| * <input [(model)]="query" type="text" /> | |
| * <ul> | |
| * <li *ngFor="let hero of heroes | search:query" >{{hero.name}}</li> | |
| * </ul> | |
| */ |
| // App | |
| import { Component } from '@angular/core'; | |
| @Component({ | |
| selector: 'app', | |
| template: '<span>{{ sayHello() }}</span>', | |
| }) | |
| export class App { | |
| public name: string = 'John'; |
By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents
| // UPD: | |
| // Now available as npm module! | |
| // Check out https://github.com/RReverser/better-log for details. | |
| console.log = (function (log, inspect) { | |
| return function () { | |
| return log.apply(this, Array.prototype.map.call(arguments, function (arg) { | |
| return inspect(arg, { depth: 1, colors: true }); | |
| })); | |
| }; |