最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Error: Unknown provider: translateFilterProvider <- translateFilter angularjs - Stack Overflow

programmeradmin7浏览0评论

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: /
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.

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/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.

Share Improve this question edited Jun 17, 2018 at 14:01 Mosh Feu 29.4k18 gold badges93 silver badges141 bronze badges asked Jul 31, 2013 at 13:17 J.PipJ.Pip 4,6237 gold badges34 silver badges54 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 4

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
});
发布评论

评论列表(0)

  1. 暂无评论