Last active
April 23, 2016 17:16
-
-
Save fxck/ea88532ecfa4084281e09443f8f0637b to your computer and use it in GitHub Desktop.
This file contains hidden or 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, | |
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