标题
.run(['$location','$rootScope',function($location,$rootScope){
$rootScope.$on('$stateChangeSuccess',function (event,toState,toParams,fromState,fromParams) {
$rootScope.title = toState.title
});
$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.src = '//m.baidu.com/favicon.ico';
iframe.style.display = 'none';
iframe.addEventListener('load',function() {
setTimeout(function() {
// iframe.removeEventListener('load');
document.body.removeChild(iframe);
},0);
});
document.body.appendChild(iframe);
});
}]);
IoUsFood',{ title:'美食住宿',url:'/delicIoUsFood',templateUrl:'/hq/views/delicIoUsFood/delicIoUsFood.html',controller:'delicIoUsFoodCtrl',resolve:{ loadMyCtrl:['$ocLazyLoad',function($ocLazyLoad){ return $ocLazyLoad.load([ '/hq/views/delicIoUsFood/delicIoUsFoodCtrl.js',]).then(function(){}) }] } })
以上所述是小编给大家介绍的Angularjs 动态改变title标题(兼容ios)。编程之家 jb51.cc 收集整理的教程希望能对你有所帮助,如果觉得编程之家不错,可分享给好友!感谢支持。