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

Emit Add event after the model is updated. #620

Closed
gicevgoran opened this issue Jun 14, 2018 · 3 comments
Closed

Emit Add event after the model is updated. #620

gicevgoran opened this issue Jun 14, 2018 · 3 comments

Comments

@gicevgoran
Copy link

Change when add event is emitted.

Expected behaviour

I think that the add event should be emitted after the model has been updated, so the user can revert the action or do something with the model.

Actual behaviour

The Add event is emitted before the model is updated so in the Add handler/callback the model still has the old value.

Here's the code:

select(item: NgOption) {
        this.itemsList.select(item);

        if (this.clearSearchOnAdd) {
            this._clearSearch();
        }

        this.addEvent.emit(item.value);
        if (this.closeOnSelect || this.itemsList.noItemsToSelect) {
            this.close();
        }

        this._updateNgModel();
}
@anjmao
Copy link
Member

anjmao commented Jun 19, 2018

@gicevgoran Probably you are correct 👍

@BruneXX
Copy link

BruneXX commented Oct 24, 2018

Hi Guys, I've noticed that the (add) output event is not fired when I'm selecting an element form the list of the ng-select.. anyone else has experienced the same behavior?

@Upendrasengar
Copy link

@BruneXX could you find the solution I'm having the same issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants