1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Argument of type 'Element | null' is not assignable to parameter of type 'Element'. Type...

Discussão em 'Angular' iniciado por Souhir, Julho 26, 2025.

  1. Souhir

    Souhir Guest

    I'm trying to create an Angular stepper form with bs-stepper, I have installed npm and add the CDN inside index.html.

    When I implement the code in my componenet.ts, I get an error:


    Argument of type 'Element | null' is not assignable to parameter of type 'Element'.
    Type 'null' is not assignable to type 'Element'.

    51 this.stepper = new Stepper(document.querySelector('#stepper1'), {
    ​

    This is my component.ts:

    import Stepper from 'bs-stepper'
    export class RegistreComponent implements OnInit {
    private stepper!: Stepper;
    next() {
    this.stepper.next();
    }
    onSubmit() {
    return false;
    }

    ngOnInit(): void {
    this.stepper = new Stepper(document.querySelector('#stepper1'), {
    linear: false,
    animation: true
    })
    }
    }

    Continue reading...

Compartilhe esta Página