ios设备中angularjs无法改变页面title的解决方法
时间:2021-06-06 08:46:07|栏目:AngularJS|点击: 次
如下所示:
$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中,代码备份下,预防下次遇到同样的问题。
栏 目:AngularJS
下一篇:angularJS利用ng-repeat遍历二维数组的实例代码
本文标题:ios设备中angularjs无法改变页面title的解决方法
本文地址:http://www.codeinn.net/misctech/136297.html






