Reputation: 94
I18n key:
"step1.download":"{{n0}} Download {{n1}} Some text."
In my html:
<span translate=step1.download translate-values="{ n0: '{{info0}}', n1: '{{info1}}'}"></span>
In my controller:
$scope.download = function(){
alert("fun executed");
};
$scope.info0="<button ng-click=download()>";
$scope.info1="</button>";
I am getting an error that download function is not defined, I think because html parsed before angular compilation, so is there any way I can solve this problem. Alternatives solutions are also appreciated.
Upvotes: 0
Views: 627
Reputation: 94
In html use "translate-compile" like this:
<span translate="step1.download" translate-compile translate-values="{ n0: '{{info0}}', n1: '{{info1}}'}"></span>
Worked with my case, it may depends on what translator you are using.It will work if you use "angular-translate.js".
Upvotes: 0
Reputation: 11
two things :
For your problem, you have to make something like this :
{
"step1.download":"Download",
"step1.someText":"some text."
}
in your html :
<span>
<button ng-click="download()">
{{'step1.download'|translate}}
</button>
{{'step1.someText'|translate}}
</span>
Upvotes: 1