Skip to content

Accessing child class members #70

@axos88

Description

@axos88

Is it possible to write something like this oversimplified snippet:

  class Filterable<T, F> {
    protected service: CrudService<T>

    protected filter$ = new BehaviourSubject<F>(null);
    protected filteredData$ = filter$.pipe(switchMap(f => this.service.filteredBy(f)) // use of this.service before initialization

    filter(f: Partial<F>) {
      this.filter$.next(f)
    }

  class ConcreteService extends CrudService<Foo, FooFilter> { ... }
  
  class Controller extends Mixin(Filterable<Foo, FooFilter>, XXX) {
    protected service = new ConcreteService(...);

    (... random uses of filter() and filteredData$ )
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions