RafaelVidaurre / angular-permission

Simple route authorization via roles/permissions
MIT License
1.13k stars 212 forks source link

IsStateChangePermissionStartDefaultPrevented returns false, despite the fact that until this point there is no call to the preventDefault () method #423

Closed emanton closed 7 years ago

emanton commented 7 years ago

angular-permission-ui, @version v5.1.1 State-based routing for AngularJS, @version v0.4.2

It seems to me that I have missed something. I am not sure that this question is coupled with issues 290 and 297, because I have not found "event.preventDefault();" before calling method isStateChangePermissionStartDefaultPrevented, which already returns false.

Yes, it is something like asking for a little help. Could you prompt me, please ? (Why isStateChangePermissionStartDefaultPrevented returns false)

masterspambot commented 7 years ago

isStateChangePermissionStartDefaultPrevented is internal method of ui-permission, whereas event.preventDefault() is pointing to ui-router's stageChange event. 📦

emanton commented 7 years ago

Oh, I see, thank you 👍 ;)

But how can I make $rootScope.$broadcast(PermTransitionEventNames.permissionStart, PermTransitionProperties.toState, PermTransitionProperties.toParams, PermTransitionProperties.options).defaultPrevented; return true ?

Because of returning "false" value from function isStateChangeStartDefaultPrevented() event stateChangeStart is called second time :(

I have been already looking for the answer second day =\