【问题标题】:Using the angular and ionic使用角度和离子
【发布时间】:2016-11-09 20:17:44
【问题描述】:

我做本地化应用程序。
我在本教程中使用:http://robferguson.org/2015/07/22/internationalisation-i18n-and-localisation-l10n-for-ionic-apps/
由浏览器控制台中的ionic serve 触发会出现以下错误:

lib.js:26793 错误:[$injector:unpr] 未知提供者: translateFilterProvider http://errors.angularjs.org/1.5.3/$injector/unpr?p0=translateFilterProvider%20%3C-%20translateFilter 在http://192.168.1.66:8100/js/lib.js:13438:12http://192.168.1.66:8100/js/lib.js:17787:19 在 Object.getService [as get] (http://192.168.1.66:8100/js/lib.js:17940:39) 在http://192.168.1.66:8100/js/lib.js:17792:45 在 Object.getService [as get] (http://192.168.1.66:8100/js/lib.js:17940:39) 在http://192.168.1.66:8100/js/lib.js:32696:24 在 isStateless (http://192.168.1.66:8100/js/lib.js:27441:12) 在 findConstantAndWatchExpressions (http://192.168.1.66:8100/js/lib.js:27498:33) 在http://192.168.1.66:8100/js/lib.js:27452:7 在 forEach (http://192.168.1.66:8100/js/lib.js:13691:20)

我做错了什么?
这是我的项目:https://github.com/igorlimansky/esteem/tree/develop
如果你不能帮助它建议阅读这个主题。

【问题讨论】:

标签: angularjs ionic-framework internationalization


【解决方案1】:

我想你只是忘了在你的模块中注入角度翻译模块,也许可以尝试替换这个:

    var app = angular.module('steem', [
        'ionic', 
        'ngStorage', 
        'ngCordova',
        'wiz.markdown',
        'rzModule',
        'ion-floating-menu',
        'ja.qr'
        //'ionic.contrib.ui.ionThread'
    ]);

通过这个:

var app = angular.module('steem', [
    'ionic', 
    'ngStorage', 
    'ngCordova',
    'wiz.markdown',
    'rzModule',
    'ion-floating-menu',
    'ja.qr',
    'pascalprecht.translate'
    //'ionic.contrib.ui.ionThread'
]);

【讨论】:

    【解决方案2】:

    检查您是否正确完成了这两点:- 包含所有翻译js并注入模块

    // Including js correctly
    <script src="bower_components/angular-translate/angular-translate.js"></script>
    <script src="bower_components/angular-translate-loader-static-files/angular-translate-loader-static-files.js"></script>
    
     //Inject modules
     angular.module('vardyger', [
       'ionic',                 
       'pascalprecht.translate'  // inject the angular-translate module
     ])
    

    【讨论】:

      猜你喜欢
      • 2015-05-15
      • 2020-01-12
      • 2021-11-18
      • 2020-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多