Reputation: 7736
Consider the following code:
import { Component } from '@angular/core';
import { CdkStepper } from '@angular/cdk/stepper';
@Component({
selector: 'stepper-form',
templateUrl: './stepper-form.component.html',
styleUrls: ['./stepper-form.component.scss'],
providers: [{ provide: CdkStepper, useExisting: StepperFormComponent }]
})
export class StepperFormComponent extends CdkStepper {
constructor(){
super();
}
}
After doing some research I found out that I need to use the super()
function. When I use it in my case , see cpde above, I get an error:
Expected 2-4 arguments, but got 0.
Which are this 2-4 arguments that I need to make the constructor work in this case?
Upvotes: 2
Views: 1647
Reputation: 11
https://github.com/angular/components/blob/master/src/cdk/stepper/stepper.ts
I assume Karolina looked up the constructor, line 330.
Which means the required imports are:
import {Directionality} from '@angular/cdk/bidi';
import {ChangeDetectorRef} from '@angular/core';
Upvotes: 1
Reputation: 31
Just add:
constructor(
dir: Directionality,
changeDetectorRef: ChangeDetectorRef,
) {
super(dir, changeDetectorRef);
}
Upvotes: 3