MobileFirst v8和bootstrap Angular JS v1.5.3错误 [英] MobileFirst v8 and bootstrap Angular JS v1.5.3 error
问题描述
我有一个使用MobileFirst Platform版本8,Ionic版本1.3.1和AngularJS版本1.5.3的Cordova应用程序。当我运行它并引导Angular JS以便应用程序首先连接到MobileFirst Platform时,我收到以下错误:
错误成功callbackId:WLAuthorizationManagerPlugin561212842:错误:[$ injector:modulerr]由于以下原因无法实例化模块ng:
TypeError:无法在$$ SanitizeUriProvider中设置null
的属性'aHrefSanitizationWhitelist'(file:/// android_asset /www/lib/ionic/js/ionic.bundle.js:30845:35)
at new< anonymous> (file:///android_asset/www/plugins/cordova-plugin-mfp/worklight/worklight.js:1079:23)
at Object.instantiate(file:/// android_asset / www / lib / ionic / js / ionic.bundle.js:18010:14)
at provider(file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17824:36)
at file :///android_asset/www/lib/ionic/js/ionic.bundle.js:13735:32
atEach(file:///android_asset/www/lib/ionic/js/ionic.bundle.js :13705:20)
at Object.provider(file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17814:9)
at ngModule(file:// /android_asset/www/lib/ionic/js/ionic.bundle.js:15863:16)
at Object.invoke(file:///android_asset/www/lib/ionic/js/ionic.bundle.js :17995:19)runInvokeQueue
(file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17888:35)
http://errors.angularjs.org /1.5.3/$injector/modulerr?p0=ng&p1=TypeError%3A%...2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17888%3A35)
可以我帮忙解决了这个问题吗?
我找到了一个类似的问题,但那是针对MobileFirst Platform版本7的,似乎没有解决。
感谢您的帮助!
新版本的<一个href =https://www.npmjs.com/package/cordova-plugin-mfp =nofollow> cordova-plugin-mfp 将在几天内发布,上述问题将在已经解决了这个问题。
- 替换worklight.js中的以下代码,您可以在以下路径中找到不同环境。
Android - Project / plugins / cordova-plugin-mfp / src / android / assets / www / worklight / worklight.js
iOS - Project / plugins / cordova-plugin-mfp / src / ios / www / worklight / worklight.js
Windows - Project / plugins / cordova-plugin-mfp / src / windows / www / worklight / worklight.js
function bind(context){
if(arguments.length< 2&& WLJSX.Object.isUndefined(arguments [0 ])){
返回此;
}
var __method = this,
args = slice.call(arguments,1);
return function(){
var a = merge(args,arguments);
返回__method.apply(context,a);
};
}
应替换为
function bind(obj){
var args = Array.prototype.slice.call(arguments,1),
self = this,
Nop = function(){
},
bound = function(){
返回self.apply(
这个instanceof Nop?this:(obj) || {}),args.concat(
Array.prototype.slice.call(arguments)
)
);
};
Nop.prototype = this.prototype || {};
bound.prototype = new Nop();
返回限制;
}
- 删除平台再次添加平台。
I have a Cordova application that uses MobileFirst Platform version 8, Ionic version 1.3.1 and AngularJS version 1.5.3. When I run it and bootstrap Angular JS so that the app connects to the MobileFirst Platform first I get the following error:
Error in Success callbackId: WLAuthorizationManagerPlugin561212842 : Error: [$injector:modulerr] Failed to instantiate module ng due to:
TypeError: Cannot set property 'aHrefSanitizationWhitelist' of null
at $$SanitizeUriProvider (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:30845:35)
at new <anonymous> (file:///android_asset/www/plugins/cordova-plugin-mfp/worklight/worklight.js:1079:23)
at Object.instantiate (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:18010:14)
at provider (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17824:36)
at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:13735:32
at forEach (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:13705:20)
at Object.provider (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17814:9)
at ngModule (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:15863:16)
at Object.invoke (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17995:19)
at runInvokeQueue (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17888:35)
http://errors.angularjs.org/1.5.3/$injector/modulerr?p0=ng&p1=TypeError%3A%…2F%2Fandroid_asset%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17888%3A35)
Can someone help me fix this?
I have found a similar question has been asked before, but that was for MobileFirst Platform version 7 and doesn't seem to be solved.
Thanks for the help!
A new version of cordova-plugin-mfp will be released in couple of days where the above issue will be addressed.
Meanwhile you can use the following workaround to resolve the issue.
- Replace the following code in worklight.js which you can find in the following path for different environments.
Android - Project/plugins/cordova-plugin-mfp/src/android/assets/www/worklight/worklight.js
iOS - Project/plugins/cordova-plugin-mfp/src/ios/www/worklight/worklight.js
Windows - Project/plugins/cordova-plugin-mfp/src/windows/www/worklight/worklight.js
function bind(context) {
if (arguments.length < 2 && WLJSX.Object.isUndefined(arguments[0])) {
return this;
}
var __method = this,
args = slice.call(arguments, 1);
return function() {
var a = merge(args, arguments);
return __method.apply(context, a);
};
}
should be replaced with
function bind(obj) {
var args = Array.prototype.slice.call(arguments, 1),
self = this,
Nop = function() {
},
bound = function() {
return self.apply(
this instanceof Nop ? this : (obj || {}), args.concat(
Array.prototype.slice.call(arguments)
)
);
};
Nop.prototype = this.prototype || {};
bound.prototype = new Nop();
return bound;
}
- Remove the platform and add the platform again.
这篇关于MobileFirst v8和bootstrap Angular JS v1.5.3错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!