mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Trigger a digest cycle when opening modals with dynamic content
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
angular.module("admin.utils").directive 'helpModal', ($compile, $templateCache, $window, DialogDefaults) ->
|
||||
angular.module("admin.utils").directive 'helpModal', ($rootScope, $compile, $templateCache, $window, DialogDefaults) ->
|
||||
restrict: 'C'
|
||||
scope:
|
||||
template: '@'
|
||||
@@ -10,8 +10,11 @@ angular.module("admin.utils").directive 'helpModal', ($compile, $templateCache,
|
||||
template.dialog(DialogDefaults)
|
||||
|
||||
# Link opening of dialog to click event on element
|
||||
element.bind 'click', (e) -> template.dialog('open')
|
||||
element.bind 'click', (e) ->
|
||||
template.dialog('open')
|
||||
$rootScope.$evalAsync()
|
||||
|
||||
scope.close = ->
|
||||
template.dialog('close')
|
||||
$rootScope.$evalAsync()
|
||||
return
|
||||
|
||||
@@ -10,12 +10,15 @@ angular.module("admin.utils").factory 'ConfirmDialog', ($rootScope, $q, $compile
|
||||
template = $compile($templateCache.get('admin/confirm_dialog.html'))(scope)
|
||||
template.dialog(DialogDefaults)
|
||||
template.dialog('open')
|
||||
$rootScope.$evalAsync()
|
||||
scope.confirm = ->
|
||||
deferred.resolve()
|
||||
template.dialog('close')
|
||||
$rootScope.$evalAsync()
|
||||
null
|
||||
scope.close = ->
|
||||
deferred.reject()
|
||||
template.dialog('close')
|
||||
$rootScope.$evalAsync()
|
||||
null
|
||||
deferred.promise
|
||||
|
||||
@@ -15,8 +15,10 @@ angular.module("admin.utils").factory 'InfoDialog', ($rootScope, $q, $compile, $
|
||||
template = $compile($templateCache.get(templateUrl))(scope)
|
||||
template.dialog(DialogDefaults)
|
||||
template.dialog('open')
|
||||
$rootScope.$evalAsync()
|
||||
scope.close = ->
|
||||
deferred.resolve()
|
||||
template.dialog('close')
|
||||
$rootScope.$evalAsync()
|
||||
null
|
||||
deferred.promise
|
||||
|
||||
Reference in New Issue
Block a user