Skip to content

"shouldFire" fails #54

@wibimaster

Description

@wibimaster

Hi !

I use the fire() method, but instead of using a (click)="...", I use the reference in the component :

  @ViewChild('triggerElt') triggerElt!: RiveSMInput;

  ngAfterViewInit() {
    this.triggerElt.fire();
  }

It fails with this error :

Uncaught TypeError: input.fire is not a function

After some investigations, this comes from the "shouldFire" mechanism.

On the init method, input is used instead of this.input. I don't know how the getInput() function works, but it seems that the input object is not complete before going through :

    init(input) {
        if (!input || input.name === this.input?.name)
            return;
        this.input = getInput(input);
        this.load.emit(input);
        if (typeof this._value !== 'undefined') {
            this.input.value = this._value;
            this.change.emit(this.input);
        }
        if (this.shouldFire) {
            this.shouldFire(input); // <---- this line should be "this.shouldFire(this.input);"
            delete this.shouldFire;
        }
    }

Am I wrong ? This solves my problem...

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions