您的位置:首页 > 移动开发 > IOS开发

解决ios设备中angularjs无法改变页面title的问题

2015-12-03 15:00 549 查看
$rootScope.$watch('title',function(title){
var body = document.getElementsByTagName('body')[0];
document.title = title;
var iframe = document.createElement("iframe");
iframe.title = '';
iframe.width = 0;
iframe.height = 0;
iframe.setAttribute("src", "/empty.png");

iframe.addEventListener('load', function() {
setTimeout(function() {
iframe.removeEventListener('load');
document.body.removeChild(iframe);
}, 0);
});
document.body.appendChild(iframe);
});
//代码放在app.js中,代码备份下,预防下次遇到同样的问题
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: