taiga-front/app/modules/services/lightbox-factory.service.co...

24 lines
525 B
CoffeeScript

class LightboxFactory
@.$inject = ["$rootScope", "$compile"]
constructor: (@rootScope, @compile) ->
create: (name, attrs) ->
scope = @rootScope.$new()
elm = $("<div>")
.attr(name, true)
.attr("tg-bind-scope", true)
if attrs
elm.attr(attrs)
elm.addClass("remove-on-close")
html = @compile(elm)(scope)
$(document.body).append(html)
return
angular.module("taigaCommon").service("tgLightboxFactory", LightboxFactory)