Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Unknown provider: translateFilterProvider <- translateFilter angularjs

I'm currently working on an angularJS app that needs to have a translation functionality, So I've checked the Angular-translate library and did everything that's in the example.

However when I run my code I get the following error:

Error: Unknown provider: translateFilterProvider <- translateFilter

I've included my code in the following jsfiddle: http://jsfiddle.net/qYqw8/1/
I loaded the angular-translate javascript file before calling the code in the fiddle (which is in portal.js) this is the order in which I load my files:

<script src="js/lib/angular.js"></script>
<script src="js/lib/angular-resource.js"></script>
<script src="js/lib/jquery-1.10.js"></script>
<script src="js/lib/angular-translate.js"></script>
<script src="js/portal.js"></script>

If anyone can help me out it's highly appreciated,
In case you wondered and since my fiddle is a bit messed up, I did bootstrap my app

<html lang="nl" ng-app="portal">

thx,

J.

like image 437
J.Pip Avatar asked Jul 31 '13 13:07

J.Pip


1 Answers

Your fiddle is a bit messed up (for example you don't bootstrap the app and some other deps are missing). But in order to use angular-translate, you need to declare it a dependency in your controller:

app.controller("MyCtrl", function($scope, $translate) {
  // do some stuff
});
like image 69
Marius Soutier Avatar answered Nov 14 '22 23:11

Marius Soutier