I have developed an app which targets WP8.1, Android and iOS. While developing for Android it is smooth sailing. I can load the adalJS libraries and make them work including authenticating and authorization to AAD. The app uses Ionic, AdalJS and AngularJS.
When I run the app for Windows phone 8.1 on the VS2015 CTP emulator it runs, until I reference the (locally downloaded in the project) adalJS files. Since the debugging support on VS2015 for WP emulator is non-existent, I do not have an error. But I found out that when I comment out the javascript for adaljs and also the injection in the app.module and app.config it will load up the page and works.
<head>
of the index.html:
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<script src="scripts/platformOverrides.js"></script>
<!-- ionic/angularjs js -->
<script src="assets/lib/ionic/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<script src="assets/lib/adaljs/adal-angular.js"></script>
<script src="assets/lib/adaljs/adal.js"></script>
<!-- your app's js -->
<script src="app/app.module.js"></script>
<script src="app/app.route.js"></script>
app.route.js
angular.module('App')
.config(['$compileProvider', '$stateProvider', '$urlRouterProvider', '$httpProvider', 'adalAuthenticationServiceProvider',
function ($compileProvider, $stateProvider, $urlRouterProvider, $httpProvider, adalProvider) { //logic here}]);
app.module.js:
angular.module('App', ['ionic','AdalAngular'])
.run(function ($ionicPlatform) {
$ionicPlatform.ready(function () {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
});
So I debugged it by deleting the references to the adal library and commenting out the adaljs script references in index.html, when I do the app launches and works.
I've tried to search for this error and found this:
Mike Jone's blog post for cordova on windows phone
Villa Rantala's blog post
Old phonegap bug which is resolved
Any suggestions?
It was a VS2015 CTP5 issue. After installing CTP6 the issue was fixed.