app.js
angular.module('starter', ['ionic', 'starter.controllers', 'services'])
.run(function ($rootScope, $ionicPlatform, $ionicLoading) {
$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();
}
});
$rootScope.$on('loading:show', function () {
$ionicLoading.show({
templateUrl: 'templates/loading.html', animation: 'fade-in', showBackdrop: true, maxWidth: 200, showDelay: 0
});
});
$rootScope.$on('loading:hide', function () {
$ionicLoading.hide();
});
})
我的loading.html出现在templates文件夹中,这个app.js位于js文件夹中。
另外,我尝试了很多东西,比如把loading.html文件和index.html放在一起,给出templateUrl:'../ templates / loading.html'。