md-expansion-panel
and md-accordion
(documentation coming soon)@angular/platform-server
(universal)
…
import { Actions, Effect } from '@ngrx/effects';
@Injectable()
export class AuthEffects {
constructor(private http: Http, private actions$: Actions) { }
@Effect() login$ = this.actions$
// Listen for the 'LOGIN' action
.ofType('LOGIN')
// Map the payload into JSON to use as the request body
.map(action => JSON.stringify(action.payload))
.switchMap(payload => this.http.post('/auth', payload)
// If successful, dispatch success action with result
.map(res => ({ type: 'LOGIN_SUCCESS', payload: res.json() }))
// If request fails, dispatch failed action
.catch(() => Observable.of({ type: 'LOGIN_FAILED' }))
);
}
import { EffectsModule } from '@ngrx/effects';
import { AuthEffects } from './effects/auth';
@NgModule({
imports: [
EffectsModule.run(AuthEffects)
]
})
export class AppModule { }
Let's look at some examples with Firebase