how to convert to JavaScript code?
app.directive 'recompileOn', ($compile) ->
directive =
scope: true
priority: 5
restrict: 'A'
compile: (element) ->
html = element[0].outerHTML
(scope, element, attrs) ->
# Internal: Will trigger a recompilation if the event is triggered.
recompileOnEvent = (eventName) ->
scope.$on eventName, (e) ->
# Remove the previously added listener, if any.
removeListener?()
# Replace the element after the digest loop that triggered the event has ended.
scope.$evalAsync ->
newEl = $compile(html)(scope.$parent)
element.replaceWith(newEl)
# Destroy the old scope, since a new one was created by using compile.
scope.$destroy()
removeListener = recompileOnEvent(attrs.recompileOn)
js2.coffee
app.directive('recompileOn', function($compile) {
var directive;
return directive = {
scope: true,
priority: 5,
restrict: 'A',
compile: function(element) {
var html;
html = element[0].outerHTML;
return function(scope, element, attrs) {
var recompileOnEvent,
removeListener;
recompileOnEvent = function(eventName) {
return scope.$on(eventName, function(e) {
if (typeof removeListener === "function") {
removeListener();
}
return scope.$evalAsync(function() {
var newEl;
newEl = $compile(html)(scope.$parent);
element.replaceWith(newEl);
return scope.$destroy();
});
});
};
return removeListener = recompileOnEvent(attrs.recompileOn);
};
}
};
});
Оборудование для ресторана: новинки профессиональной кухонной техники
Частный дом престарелых в Киеве: комфорт, забота и профессиональный уход
ЗдравствуйтеКак на открытом в браузере сайте отобрать элементы? К примеру добавить кнопку перед картинкой что скачать её
Первый раз вижу такой кодне пойму, что тут происходит?