This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {bootstrap} from 'angular2/core'; | |
import {routerConfig, HashLocationStrategy} from 'angula2/router'; | |
import {App} from './app'; | |
bootstrap(App, [ | |
routerConfig({ | |
locationStrategy: HashLocationStrategy | |
}) | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var rxjs_subject_BehaviorSubject = require('rxjs/subject/BehaviorSubject'); | |
var rxjs_add_operator_map = require('rxjs/add/operator/map'); | |
var rxjs_add_operator_distinctUntilChanged = require('rxjs/add/operator/distinctUntilChanged'); | |
var rxjs_Subject = require('rxjs/Subject'); | |
var rxjs_add_operator_let = require('rxjs/add/operator/let'); | |
var rxjs_add_operator_scan = require('rxjs/add/operator/scan'); | |
var angular2_core = require('angular2/core'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A proof-of-concept for a new modal lib for Angular 2 | |
* | |
* Goals: | |
* - Easy to style | |
* - Easy to control with @ngrx/store | |
* - Completely stateless | |
* | |
* How to use: | |
* In your root component, add `ModalConnector` to your providers array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'rxjs/add/operator/catch'; | |
import 'rxjs/add/operator/map'; | |
import 'rxjs/add/operator/mapTo'; | |
import 'rxjs/add/operator/filter'; | |
import 'rxjs/add/operator/mergeMap'; | |
import 'rxjs/add/operator/switchMap'; | |
import 'rxjs/add/operator/switchMapTo'; | |
import 'rxjs/add/operator/toArray'; | |
import 'rxjs/add/operator/mergeAll'; | |
import 'rxjs/add/operator/groupBy'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pipe } from '@angular/core'; | |
@Pipe({ name: 'sortNames' }) | |
export class SortNamesPipe { | |
transform(input: string[]): string[] { | |
return input.sort(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
import { Observable } from 'rxjs/Observable'; | |
import { Book } from './models/book'; | |
import { BooksService } from './services/books-service'; | |
@Component({ | |
selector: 'books-app', | |
template: ` | |
<books-header></books-header> | |
<book-card |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'rxjs/add/observable/of'; | |
import { Injectable } from '@angular/core'; | |
import { Observable } from 'rxjs/Observable'; | |
import { Book } from '../models/book'; | |
@Injectable() | |
export class BooksService { | |
getBooks(): Observable<Book[]> { | |
return Observable.of([ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { defaultMemoize as memoize } from 'reselect'; | |
export interface StreamSelector<A,B> { | |
(input$: Observable<T>): Observable<R>; | |
} | |
export interface Share { | |
<A,B>(): StreamSelector<A,B>; | |
<A,B,C>(c: C): StreamSelector<A,B>; | |
<A,B,C,D>(c: C, d: D): StreamSelector<A,B>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'rxjs/add/observable/of'; | |
import { Observable } from 'rxjs/Observable'; | |
const mockRestService = { | |
get: jasmine.createSpy('get').and.returnValue(Observable.of({ | |
})) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ApolloStore } from 'apollo-client'; | |
import { Store } from '@ngrx/store'; | |
import { skip } from 'rxjs/operator/skip'; | |
import { take } from 'rxjs/operator/take'; | |
export function toApolloStore(store: Store<any>): ApolloStore { | |
return { | |
subscribe(fn: () => void): () => void { | |
const futureStates$ = skip.call(store, 1); |