JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.angularjs.org/angular-1.0.1.min.js"></script>
<script src="http://code.angularjs.org/angular-resource-1.0.1.min.js"></script>
<div ng-app="torchApp">
{{"default text" | i18n:"codeParam"}}
times called: {{timesCalled}}
</div>
JavaScript
angular.module("torchFilters", []).filter("i18n", function ($http) {
return function (string) {
if (arguments.length > 1)
{
var code = arguments[1];
// uncomment me to the popup over and over again
alert("this is the alert that never ends...");
$http.post("/echo/html/", {html: "test"}).success(function(data) {
string = "hard coded text";
});
}
return string;
}
});
angular.module("torchApp", ["torchFilters"]);