I'm trying to use mixins in angular for the first time.
I want my base class to call its mixins in an init() method:
const baseClass = mixinA(mixinB(class {
func: {A: () => void, B: () => void} = {}
init():void {
this.func.A()
this.func.B()
}
My idea was to use onInit to populate func:
export function mixinA (Base) {
return class extends Base {
a():void {
....
}
ngOnInit {
this.func = {...this.func, A: this.a}
}
mixinB following the same model.
Unfortunately, this does not work. A is properly registered in func, but B isn't. Would you have an idea why?