zurb / foundation-apps

The first front-end framework created for developing fully responsive web apps.
http://foundation.zurb.com/apps
MIT License
1.58k stars 216 forks source link

Opening a notification using publish triggers '$apply already in progress' error #709

Open jmkenz opened 8 years ago

jmkenz commented 8 years ago

For example, if have a notification like so:

zf-notification-static id="static-alert-message"

That gets opened like so:

FoundationApi.publish('static-alert-message', 'open')

Which triggers an '$apply already in progress' error.

Suggested fix to notification.js, line 255:

if (!scope.$root.$$phase) { scope.$apply(); }

ksr583 commented 8 years ago

I'm still getting this error all over the place when using panels as well. If someone finds an answer to this, I'd love to hear about it.

jmkenz commented 8 years ago

Another fix is to wrap the publish in a $timeout. The time can be set to 0.

$timeout(function(){ FoundationApi.publish('static-alert-message', 'open') }, 0);

heppy83 commented 8 years ago

I still get the same error with a publish for show/hide/toggle a POPUP.

Also tried to update to version 1.2.0 but it did not solve the issue. Impossible to programmatically manage a Popup.

The fix to wrap in a $timeout did not work for me. I don't get the error anymore, but the publish doesn't have any effect (nothing gets opened/closed)