我在浏览器控制台中收到所有与翻译相关的警告,因此我想禁止/禁用所有相关警告(不要向用户显示)
部门的翻译不存在 a。(匿名函数)@ _bower.9144598 ... .js:75 (匿名)@ _bower.9144598 ... .js:5 (匿名)@ _bower.9144598 ... .js:59 Z @ _bower.9144598 ... .js:58 R.instant @ _bower.9144598 ... .js:58 c @ _bower.9144598 ... .js:59 fn @ VM673:4 (匿名)@ _bower.9144598 ... .js:5 $ digest @ _bower.9144598 ... .js:6 (匿名)@ _bower.9144598 ... .js:6 f @ _bower.9144598 ... .js:4 (匿名)@ _bower.9144598 ... .js:4 d @ _bower.9144598 ... .js:75
答案 0 :(得分:1)
您可以使用此处描述的useMissingTranslationHandler https://angular-translate.github.io/docs/#/guide/17_custom-error-handler
var app = angular.module('myApp', ['pascalprecht.translate'], function ($translateProvider) { // tell angular-translate to use your custom handler $translateProvider.useMissingTranslationHandler('myCustomHandlerFactory'); }); // define custom handler app.factory('myCustomHandlerFactory', function (dep1, dep2) { // has to return a function which gets a tranlation ID return function (translationID) { // do something with dep1 and dep2 }; });