From 5e6bc871762aadc41898e1e91092fb8080451fe4 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 23 Jul 2014 09:41:19 +0200 Subject: [PATCH] Add bind title directive. --- app/coffee/modules/base/bind.coffee | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/coffee/modules/base/bind.coffee b/app/coffee/modules/base/bind.coffee index 49a99126..b66ac836 100644 --- a/app/coffee/modules/base/bind.coffee +++ b/app/coffee/modules/base/bind.coffee @@ -57,6 +57,13 @@ BindOnceTitleDirective = -> $el.attr("title", val) return {link:link} +BindTitleDirective = -> + link = ($scope, $el, $attrs) -> + $scope.$watch $attrs.tgTitleHtml, (val) -> + $el.attr("title", val) if val? + + return {link:link} + BindHtmlDirective = -> link = ($scope, $el, $attrs) -> $scope.$watch $attrs.tgBindHtml, (val) -> @@ -64,11 +71,11 @@ BindHtmlDirective = -> return {link:link} - module = angular.module("taigaBase") module.directive("tgBoHtml", BindOnceHtmlDirective) module.directive("tgBoRef", BindOnceRefDirective) module.directive("tgBoSrc", BindOnceSrcDirective) module.directive("tgBoAlt", BindOnceAltDirective) module.directive("tgBoTitle", BindOnceTitleDirective) +module.directive("tgBindTitle", BindTitleDirective) module.directive("tgBindHtml", BindHtmlDirective)