Skip to content

Instantly share code, notes, and snippets.

View robwormald's full-sized avatar

Rob Wormald robwormald

View GitHub Profile
<p>hello {{name}}</p>
<ul>
<li *ngFor="let item of items">{{item.name}}</li>
</ul>

RxJS Cache Operator

RxJS RC0 removed the cache operator - see ReactiveX/rxjs#2012 for more detail

This gist includes the removed operator in case you are using it in existing app. We recommend migrating off of this operator in favor of a supported one, but you may use this one temporarily.

If you're using Typescript, simply include the .ts file in the gist somewhere in your project, and import the file somewhere in your app.

If you're using an ES5 build of Angular, simply require or include the cache-operator.umd.js file included here.

@Component({
selector: 'child-dumb-component',
template: `
<button>clicky</button>
`
})
export class ChildDumbComponent {
@Output() customEvent = new EventEmitter();
}
interface Position {
left:string;
top: string;
}
@Component({
selector: 'drag-demo',
template: `
<div #target [ngStyle]="boxPosition | async">drag me</div>
`
})
@robwormald
robwormald / a.ts
Last active November 11, 2016 04:41
import {NgModule} from '@angular/core'
import {ModuleB} from './b'
@Component({
selector: 'component-a',
template: `
<component-b></component-b>
`
})
export class ComponentA {}
const [moreThanTwo, lessThanTwo] = someObservable.partition(v => v > 2);
const [moreThanTwo, lessThanTwo] = someObservable.partition(v => v > 2);
//@angular/webpack plugin main
import 'reflect-metadata';
import { ReflectiveInjector, OpaqueToken, NgModule } from '@angular/core'
import * as ts from 'typescript'
import * as ngCompiler from '@angular/compiler-cli'
import * as tscWrapped from '@angular/tsc-wrapped'
import * as tsc from '@angular/tsc-wrapped/src/tsc'
import * as path from 'path'
import * as fs from 'fs'
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
// @version 0.7.22