Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"shouldFire" fails #54

Open
wibimaster opened this issue Dec 18, 2023 · 0 comments · May be fixed by #55
Open

"shouldFire" fails #54

wibimaster opened this issue Dec 18, 2023 · 0 comments · May be fixed by #55

Comments

@wibimaster
Copy link

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 !

wibimaster added a commit to wibimaster/ng-rive that referenced this issue Dec 18, 2023
@wibimaster wibimaster linked a pull request Dec 18, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant