Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
fix(filter): mark filter being stateful required since Angular 1.3 rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
knalli committed Sep 18, 2014
1 parent 2204f4f commit bffbf04
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/filter/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,18 @@ angular.module('pascalprecht.translate')
</example>
*/
.filter('translate', ['$parse', '$translate', function ($parse, $translate) {
return function (translationId, interpolateParams, interpolation) {
var translateFilter = function (translationId, interpolateParams, interpolation) {

if (!angular.isObject(interpolateParams)) {
interpolateParams = $parse(interpolateParams)(this);
}

return $translate.instant(translationId, interpolateParams, interpolation);
};

// Since AngularJS 1.3, filters which are not stateless (depending at the scope)
// have to explicit define this behavior.
translateFilter.$stateful = true;

return translateFilter;
}]);

1 comment on commit bffbf04

@Francisc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome.

Please sign in to comment.