Remove useless data/event binding on i18n directive.

stable
Andrey Antukh 2014-10-10 00:22:48 +02:00
parent 781f31a4cb
commit d145e272f7
1 changed files with 7 additions and 11 deletions

View File

@ -53,18 +53,14 @@ I18nDirective = ($rootscope, $i18n) ->
link = ($scope, $el, $attrs) ->
values = $attrs.tr.split(",")
options = $attrs.trOpts or '{}'
opts = $scope.$eval(options)
applyTranslation = ->
opts = $scope.$eval(options)
for v in values
if v.indexOf(":") == -1
$el.html(_.escape($scope.t(v, opts)))
else
[ns, v] = v.split(":")
$el.attr(ns, _.escape($scope.t(v, opts)))
bindOnce($scope, "t", applyTranslation)
$scope.$on("i18n:changeLang", applyTranslation)
for v in values
if v.indexOf(":") == -1
$el.html(_.escape($i18n.t(v, opts)))
else
[ns, v] = v.split(":")
$el.attr(ns, _.escape($i18n.t(v, opts)))
return {
link: link