mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-28 21:07:16 +00:00
17 lines
591 B
CoffeeScript
17 lines
591 B
CoffeeScript
Darkswarm.directive "ofnModal", ($modal)->
|
|
restrict: 'E'
|
|
replace: true
|
|
transclude: true
|
|
scope: {}
|
|
template: "<a>{{title}}</a>"
|
|
|
|
link: (scope, elem, attrs, ctrl, transclude)->
|
|
scope.title = attrs.title
|
|
contents = null
|
|
elem.on "click", =>
|
|
# We're using an isolate scope, which is a child of the original scope
|
|
# We have to compile the transclude against the original scope, not the isolate
|
|
transclude scope.$parent, (clone)->
|
|
contents = clone
|
|
scope.modalInstance = $modal.open(controller: ctrl, template: contents, scope: scope.$parent)
|