[英]AngularJs routing delay and mobile application
I am using AngularJs to make a PhoneGap application. 我正在使用AngularJs制作PhoneGap应用程序。
I have 4 pages. 我有4页。 And I am using angular-route to make it a single page application.
我正在使用angular-route将其设为单页应用程序。
But the problem is the delay of requesting each page it is not a good experience for the users. 但问题是请求每个页面的延迟对用户来说不是一个好的体验。 Is there any tricky solution for this problem ?
这个问题有什么棘手的解决方案吗?
app.config(['$routeProvider',function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'pages/main.html',
controller: 'MainCtrl'
})
.when('/view', {
templateUrl: 'pages/view.html'
})
.when('/view/:idType/:movieID', {
templateUrl: 'pages/view.html'
})
.when('/results/:queryType/:query', {
templateUrl: 'pages/results.html'
})
.otherwise({
redirectTo: '/'
})
}]);
你是什么意思“请求每个页面的延迟”你可以做几件事来优化你的加载时间,但很少有特定的角度,你只需要遵循响应式设计/渐进增强规则,你的模板应该加载得很好,现在您总是可以使用$ templateCache服务将模板保存在单个JS文件中,如果您在路由上使用resolve子句,请确保延迟不在api上,同时确保不执行可能的大量循环在控制器创建过程中阻止您的ui可能会给您带来缓慢加载的印象,您是否可以检查网络选项卡并分享您的API和模板加载时间以获取更详细的信息?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.