MobileFirst v8 and bootstrap Angular JS v1.5.3 error

℡╲_俬逩灬. 提交于 2019-12-18 09:40:02

问题


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!


回答1:


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.

  1. 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;
}
  1. Remove the platform and add the platform again.


来源:https://stackoverflow.com/questions/38902169/mobilefirst-v8-and-bootstrap-angular-js-v1-5-3-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!