2016-05-19 34 views
2

我使用以下鏈接開發了Ionic Side Menu應用程序和集成的IBM MobileFirst Platform Foundation 7.1。Ionic Mobile首次集成

https://www.raymondcamden.com/2015/03/23/working-with-ibm-mobilefirst-and-the-ionic-framework/

當我試圖建立&運行它拋出一個錯誤

worklight.js:5383 Uncaught Exception: Uncaught Error: [$injector:modulerr] Failed to instantiate module ng due to: TypeError: Cannot set property 'aHrefSanitizationWhitelist' of null at $$SanitizeUriProvider

我用Google搜索,發現下面的堆棧溢出鏈接,但使用最新版本的角度還是同樣的問題,試過。

IBM MobileFirst平臺的建立7.1
的Java SDK 1.8
離子版本1.7.14

app.js

// Ionic Starter App 
 

 
// angular.module is a global place for creating, registering and retrieving Angular modules 
 
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html) 
 
// the 2nd parameter is an array of 'requires' 
 
// 'starter.controllers' is found in controllers.js 
 
angular.module('starter', ['ionic', 'starter.controllers']) 
 

 
.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.Keyboard) { 
 
     cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); 
 
     cordova.plugins.Keyboard.disableScroll(true); 
 

 
    }*/ 
 
    if (window.StatusBar) { 
 
     // org.apache.cordova.statusbar required 
 
     StatusBar.styleDefault(); 
 
    } 
 
    }); 
 
}) 
 

 
.config(function($stateProvider, $urlRouterProvider) { 
 
    $stateProvider 
 

 
    .state('app', { 
 
    url: '/app', 
 
    abstract: true, 
 
    templateUrl: 'templates/menu.html', 
 
    controller: 'AppCtrl' 
 
    }) 
 

 
    .state('app.search', { 
 
    url: '/search', 
 
    views: { 
 
     'menuContent': { 
 
     templateUrl: 'templates/search.html' 
 
     } 
 
    } 
 
    }) 
 

 
    .state('app.browse', { 
 
     url: '/browse', 
 
     views: { 
 
     'menuContent': { 
 
      templateUrl: 'templates/browse.html' 
 
     } 
 
     } 
 
    }) 
 
    .state('app.playlists', { 
 
     url: '/playlists', 
 
     views: { 
 
     'menuContent': { 
 
      templateUrl: 'templates/playlists.html', 
 
      controller: 'PlaylistsCtrl' 
 
     } 
 
     } 
 
    }) 
 

 
    .state('app.single', { 
 
    url: '/playlists/:playlistId', 
 
    views: { 
 
     'menuContent': { 
 
     templateUrl: 'templates/playlist.html', 
 
     controller: 'PlaylistCtrl' 
 
     } 
 
    } 
 
    }); 
 
    // if none of the above states are matched, use this as the fallback 
 
    $urlRouterProvider.otherwise('/app/playlists'); 
 
});
index.html 
 

 
<!DOCTYPE html> 
 
<html> 
 
    <head> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> 
 
    <title></title> 
 

 
    <link href="lib/ionic/css/ionic.css" rel="stylesheet"> 
 
    <link href="css/style.css" rel="stylesheet"> 
 

 
    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above 
 
    <link href="css/ionic.app.css" rel="stylesheet"> 
 
    --> 
 

 
    <!-- ionic/angularjs js --> 
 
    <script src="lib/ionic/js/ionic.bundle.js"></script> 
 
    
 

 
    <!-- cordova script (this will be a 404 during development) --> 
 
<!--  <script src="cordova.js"></script> --> 
 
    <script>window.$ = window.jQuery = WLJQ;</script> 
 

 
    <!-- your app's js --> 
 
    <script src="js/app.js"></script> 
 
    <script src="js/controllers.js"></script> 
 
    <script src="js/wlinit.js"></script> 
 
    </head> 
 

 
    <body ng-app="starter"> 
 
    <ion-nav-view></ion-nav-view> 
 
    </body> 
 
</html>

+0

更新版本請出示'app.js'和'index.html'。 – t0mm13b

+0

我編輯了這個問題,請找到它 –

+0

我沒有在代碼中看到對'SanitizeUriProvider'的引用,你有適當的腳本,並在你的應用程序中引用? – t0mm13b

回答

0

更新:MobileFirst平臺的建立7.1現在支持1.5角;從IBM Fix Central升級到最新的iFix。

Angular 1.5和MFP 7.1之間存在不兼容問題。

要成功製作帶有MFP 7.1的Ionic應用程序,必須使用低於1.3的離子版本(1.2.4哥本哈根爲最新版本)。

離子1.3中引入角1.5

+0

我編輯了這個問題,請找到它 –

+0

@MadhuMadhuri你在模擬器/本機而不是預覽上試過了嗎? –

+0

我沒有嘗試在模擬器中。我只是運行並預覽App –

0

由於角似乎是唯一改變的變量,這可能是一個問題的角度,而不是。

我建議嘗試這個

https://github.com/csantanapr/mfp-ionic-templates

+0

建議我嘗試使用離子版本1.2.4,然後我得到本地主機錯誤,我也嘗試使用離子1.3.22,然後得到相同的錯誤:worklight.js:5383未捕獲異常:未捕獲錯誤:[$ injector:modulerr]無法實例化模塊ng由於: TypeError:無法在$$ SanitizeUriProvider上將屬性'aHrefSanitizationWhitelist'設置爲null –