Remove useless data/event binding on i18n directive.
parent
781f31a4cb
commit
d145e272f7
|
@ -53,18 +53,14 @@ I18nDirective = ($rootscope, $i18n) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
values = $attrs.tr.split(",")
|
values = $attrs.tr.split(",")
|
||||||
options = $attrs.trOpts or '{}'
|
options = $attrs.trOpts or '{}'
|
||||||
|
opts = $scope.$eval(options)
|
||||||
|
|
||||||
applyTranslation = ->
|
for v in values
|
||||||
opts = $scope.$eval(options)
|
if v.indexOf(":") == -1
|
||||||
for v in values
|
$el.html(_.escape($i18n.t(v, opts)))
|
||||||
if v.indexOf(":") == -1
|
else
|
||||||
$el.html(_.escape($scope.t(v, opts)))
|
[ns, v] = v.split(":")
|
||||||
else
|
$el.attr(ns, _.escape($i18n.t(v, opts)))
|
||||||
[ns, v] = v.split(":")
|
|
||||||
$el.attr(ns, _.escape($scope.t(v, opts)))
|
|
||||||
|
|
||||||
bindOnce($scope, "t", applyTranslation)
|
|
||||||
$scope.$on("i18n:changeLang", applyTranslation)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
link: link
|
link: link
|
||||||
|
|
Loading…
Reference in New Issue