Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

model change: ng-if before ng-click #9644

Closed
metrophos opened this issue Oct 16, 2014 · 2 comments
Closed

model change: ng-if before ng-click #9644

metrophos opened this issue Oct 16, 2014 · 2 comments

Comments

@metrophos
Copy link

Since lib version 1.3.0-rc.4 and above the process order of ng-if and ng-click are changed relating to model changes.
The Problem comes with the follow lib fix on rc4: register builtin parsers/formatters before anyone else (1064443, #9218, #9358)

Here is an example for what i mean: http://plnkr.co/vAZABD6jJvgPNdTrO2fI?p=preview

@tdakhla
Copy link

tdakhla commented Oct 16, 2014

This is interesting cause in my issue (#9564), I actually want ngModel to bind first, but in your case you want the ngClick to fire and the results of that to be propagated first.

I'm not sure what the solution is to make both work, but here's your fiddle which simply alerts what the $scope.test value is after clicking "show" (to better highlight the differences/ordering between pre- and post- rc4): http://plnkr.co/edit/4pSgSYx6Ia77kATLiFps?p=preview

@petebacondarwin
Copy link
Member

For the same reasons as in #9564 I don't think you should rely on model events and click events to occur in any particular order. JavaScript is inherently asynchronous and you should probably program not to rely on such events being ordered.

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

No branches or pull requests

3 participants