Skip to content

Instantly share code, notes, and snippets.

@fxck
Last active April 23, 2016 17:16
Show Gist options
  • Save fxck/ea88532ecfa4084281e09443f8f0637b to your computer and use it in GitHub Desktop.
Save fxck/ea88532ecfa4084281e09443f8f0637b to your computer and use it in GitHub Desktop.
import {
Component,
OnInit,
OnDestroy
} from 'angular2/core';
import { Observable } from 'rxjs/Observable';
import { Store } from '@ngrx/store';
// action creators
import { login } from '../../services/auth-actions.service';
// components
import {
LoginFormComponent
} from '../../components/login-form.component/login-form.component';
@Component({
selector: 'auth-route',
directives: [ LoginFormComponent ],
template: require('./auth.route.html')
})
export class AuthRoute implements OnInit, OnDestroy {
@ObserveChild('.login', 'click')
public onLogin$: EventEmitter<MouseEvent>;
public loginAction$ = this.onLogin$.map(login());
$ngOnInit
.merge(this.logionAction$)
.takeUntil($ngOnDestroy)
.subscribe(this._store);
constructor(private _store: Store<any>) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment