{{ count() }}
14 | @if (isLoading()) { 15 |Loading...
16 | } 17 | `, 18 | }) 19 | export class AppComponent { 20 | injector = inject(EnvironmentInjector); 21 | count = injectSelector((state: RootState) => state.counter.value); 22 | isLoading = injectSelector((state: RootState) => state.counter.isLoading); 23 | dispatch = injectDispatchCount: {{count()}}
', 86 | }) 87 | class Comp { 88 | count = injectSelector((state: any) => state.counter.value); 89 | dispatch = injectDispatch(); 90 | increment = counterSlice.actions.increment; 91 | 92 | ngOnInit() { 93 | this.dispatch(this.increment()); 94 | } 95 | } 96 | 97 | const { getByText } = await render(Comp, { 98 | providers: [provideRedux({ store })], 99 | }); 100 | 101 | await waitFor(() => expect(getByText('Count: 1')).toBeInTheDocument()); 102 | }); 103 | 104 | it("should not throw an error on a required input passed to the selector's fn", async () => { 105 | const store = configureStore({ 106 | reducer: { 107 | counter: counterSlice.reducer, 108 | }, 109 | }); 110 | 111 | @Component({ 112 | selector: 'app-count-and-add', 113 | standalone: true, 114 | template: ` 115 | 118 |Count: {{ count() }}
119 | `, 120 | }) 121 | class CountAndAdd { 122 | dispatch = injectDispatch(); 123 | increment = counterSlice.actions.increment; 124 | addBy = input.required