@@ -402,12 +402,10 @@ export const loadUsersFailure = createAction(
402402exports [` ngrx NgModule Syntax should generate the ngrx effects 1` ] = `
403403"import { Injectable , inject } from '@angular/core';
404404import { createEffect , Actions , ofType } from '@ngrx/effects';
405-
405+ import { switchMap , catchError , of } from 'rxjs';
406406import * as UsersActions from './users.actions';
407407import * as UsersFeature from './users.reducer';
408408
409- import { switchMap , catchError , of } from 'rxjs';
410-
411409@Injectable()
412410export class UsersEffects {
413411 private actions$ = inject (Actions );
@@ -756,12 +754,10 @@ export const appRoutes: Routes = [
756754exports[`ngrx angular v14 support should generate the ngrx effects using "inject" for versions >= 14.1.0 1`] = `
757755"import { Injectable , inject } from '@angular/core';
758756import { createEffect , Actions , ofType } from '@ngrx/effects';
759-
757+ import { switchMap , catchError , of } from 'rxjs';
760758import * as UsersActions from './users.actions';
761759import * as UsersFeature from './users.reducer';
762760
763- import { switchMap , catchError , of } from 'rxjs';
764-
765761@Injectable()
766762export class UsersEffects {
767763 private actions$ = inject (Actions );
@@ -868,3 +864,29 @@ export class UsersFacade {
868864}
869865"
870866`;
867+
868+ exports[`ngrx rxjs v6 support should generate the ngrx effects using rxjs operators imported from "rxjs/operators" 1`] = `
869+ "import { Injectable , inject } from '@angular/core';
870+ import { createEffect , Actions , ofType } from '@ngrx/effects';
871+ import { of } from 'rxjs';
872+ import { switchMap , catchError } from 'rxjs/operators';
873+ import * as UsersActions from './users.actions';
874+ import * as UsersFeature from './users.reducer';
875+
876+ @Injectable()
877+ export class UsersEffects {
878+ private actions$ = inject (Actions );
879+
880+ init$ = createEffect (() =>
881+ this .actions$ .pipe (
882+ ofType (UsersActions .initUsers ),
883+ switchMap (() => of (UsersActions .loadUsersSuccess ({ users: [] }))),
884+ catchError ((error ) => {
885+ console .error (' Error' , error );
886+ return of (UsersActions .loadUsersFailure ({ error }));
887+ })
888+ )
889+ );
890+ }
891+ "
892+ `;
0 commit comments