ngneat / effects

🪄 A framework-agnostic RxJS effects implementation
https://www.netbasal.com
MIT License
63 stars 11 forks source link

can I use without inheritance in angular? #27

Closed jon9090 closed 2 years ago

jon9090 commented 2 years ago

Which @ngneat/effects-* package(s) are relevant/releated to the feature request?

effects

Description

Is it possible to use it in angular without inheritance?

Here my suggestion:

@Injectable({ providedIn: 'root' })
export class TodosEffects {

  addTodo = createEffect((actions) =>
    actions.pipe(
      ofType(addTodo),
      tap(console.log)
    )
  );
}

@Component({
  ...
  providers: [TodoEffects]
})
export class Component {

 constructor(private todosEffects: TodoEffects) {}

  addTodo() {
    this.todosEffects.addTodo();
  }
}

Proposed solution

see in description

Alternatives considered

n/a

Do you want to create a pull request?

Yes

NetanelBasal commented 2 years ago

What about the cleaning?