А если так загрузить будет ошибка (
<html ng-app="app" >
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script>
</head>
<body ng-controller="translateController">
<h1 translate>Hello!</h1>
<h1 translate>Bye</h1>
<script>
var app = angular.module('app', []);
app
.controller('translateController', ['$scope', '$http', function ($scope, $http) {
$scope.dictionary = {"Hello!" : "Привет!","Bye" : "Пока"}
}])
.directive("translate", function () {
return {
compile: function (elem) {
var text = elem.text();
elem.html('{{dictionary[text]}}');
return function (scope) {
scope.text = text;
}
}
}
})
</script>
</body>
</html>