【发布时间】:2016-05-19 09:01:33
【问题描述】:
我使用以下链接开发了 Ionic Side Menu 应用程序并集成了 IBM MobileFirst Platform Foundation 7.1。
https://www.raymondcamden.com/2015/03/23/working-with-ibm-mobilefirst-and-the-ionic-framework/
当我尝试构建并运行它时抛出错误
worklight.js:5383 未捕获的异常:未捕获的错误: [$injector:modulerr] 无法实例化模块 ng,原因是: TypeError:无法将属性“aHrefSanitizationWhitelist”设置为 null 在 $$SanitizeUriProvider
我用谷歌搜索并找到了下面的堆栈溢出链接,但尝试使用最新的 Angular 版本仍然是同样的问题。
- AngularJS 1.5 error bootstrap IBM Mobilefirst
- Failed to instantiate module error in Angular js
- https://github.com/angular/angular.js/issues/9692
IBM MobileFirst Platform Foundation 7.1
Java SDK 1.8
IONIC 版本 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>
【问题讨论】:
-
请出示
app.js和index.html。 -
我编辑了问题,请找到它
-
我没有在您的代码中看到对
SanitizeUriProvider的引用,您是否有适当的脚本并在您的应用程序中引用? -
SanitizeUriProvider 在 ionic.bundle.js 中
-
您是否在 Angular 模块中添加了对
ng-sanitize的引用?
标签: angularjs ionic-framework ibm-mobilefirst