Javascript 应用程序在浏览器中运行良好,在手机上显示空白屏幕
我正在使用Ionic框架、Phonegap和AngularJS创建一个应用程序 我有一个指示,项目。在浏览器中运行应用程序时,此指令工作正常。然而,当使用iOS7运行在我的iphone5c上编译的应用程序时,该指令没有显示出来 如果我复制指令的HTML模板并将其放到页面上,它就可以正常工作 以下是指令:Javascript 应用程序在浏览器中运行良好,在手机上显示空白屏幕,javascript,angularjs,cordova,ionic-framework,Javascript,Angularjs,Cordova,Ionic Framework,我正在使用Ionic框架、Phonegap和AngularJS创建一个应用程序 我有一个指示,项目。在浏览器中运行应用程序时,此指令工作正常。然而,当使用iOS7运行在我的iphone5c上编译的应用程序时,该指令没有显示出来 如果我复制指令的HTML模板并将其放到页面上,它就可以正常工作 以下是指令: ItemModule.directive('item', ['$rootScope', function ($rootScope) { return { restrict
ItemModule.directive('item', ['$rootScope', function ($rootScope) {
return {
restrict: 'E',
scope: {
item: '=',
},
transclude: true,
templateUrl: 'js/modules/items/directives/templates/item.html',
link: function (scope, iElement, iAttrs) {
}
};
}])
.config(function($stateProvider, $urlRouterProvider, $sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
// Allow same origin resource loads.
'self',
// Allow loading from our other assets domain. Notice there is a difference between * and **.
'http://km.support.apple.com/**',
]);
})
我做错了什么?这看起来是一个解决问题的方法。请根据手机设备检查分辨率 页面上有固定的高度/宽度控制,不允许在手机上呈现页面并显示空白屏幕
为了使您的web应用程序具有响应性,您还可以使用引导 您说ajax调用成功了,但它执行正确吗 请在您的指令之前尝试:
ItemModule.directive('item', ['$rootScope', function ($rootScope) {
return {
restrict: 'E',
scope: {
item: '=',
},
transclude: true,
templateUrl: 'js/modules/items/directives/templates/item.html',
link: function (scope, iElement, iAttrs) {
}
};
}])
.config(function($stateProvider, $urlRouterProvider, $sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
// Allow same origin resource loads.
'self',
// Allow loading from our other assets domain. Notice there is a difference between * and **.
'http://km.support.apple.com/**',
]);
})
在手机上运行appon时是否存在javascript错误?您可以使用Safari的web检查器来确保。将其放在所有index.html js脚本的顶部:window.onerror=function(message,url,lineNumber){alert(“Error:“+message+”在“+url+”在“+lineNumber”行);}它应该会提醒您js错误,请确保将它放在页面的最顶端,就像在中一样,并且在其他任何错误之前都没有错误,AJAX调用正在成功完成。我将尝试用模板替换templateUrl,并将html设置为内联。如果这样做有效,至少你会知道什么是坏的。内容没有样式,所以这不是一个解决问题