kevinchappell/ng-i18n

View on GitHub
src/ng-i18n-directive.js

Summary

Maintainability
A
0 mins
Test Coverage
angular.module('ngI18n')
  .directive('ngI18n', ['I18N', function(I18N) {
    'use strict';

    return {
      restrict: 'E',
      scope: {
        key: '@'
      },
      link: function(scope, element, attrs) {
        var value;

        function updateString() {
          value = I18N.parseArgs(attrs.key, attrs);
          element.html(value);
        }

        scope.$watch(updateString);
      }
    };
  }]);