亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Angularjs 動(dòng)態(tài)改變title標(biāo)題(兼容ios)

 更新時(shí)間:2016年12月29日 12:00:43   作者:tanmuxue  
這篇文章主要介紹了 Angularjs 動(dòng)態(tài)改變title標(biāo)題(兼容ios)的相關(guān)資料,需要的朋友可以參考下

廢話不多說(shuō)了,直接給大家貼代碼了,具體代碼如下所示:

<pre name="code" class="javascript">angular.module('myApp.loginCtrl', []) 
  .config(function($httpProvider) { 
    $httpProvider.defaults.headers.post['Content-Type']='application/x-www-form-urlencoded;charset=utf-8'; 
//改變header中content-type的格式 
  }) 
.controller('loginCtrl',['$scope','$http',function($scope,$http){}]) 
//兼容ios動(dòng)態(tài)改變title標(biāo)題 
.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); 
  }); 
}]); </pre><br> 
<br> 
<pre></pre> 
<pre code_snippet_id="2083087" snippet_file_name="blog_20161229_4_8475823" name="code" class="javascript">//路由<pre name="code" class="javascript">  .state('deliciousFood',{ 
   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(){}) 
    }] 
   }  
  })</pre><br> 
<pre></pre> 
<br> 
</pre> 

以上所述是小編給大家介紹的Angularjs 動(dòng)態(tài)改變title標(biāo)題(兼容ios),希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

  • Angular 中 select指令用法詳解

    Angular 中 select指令用法詳解

    這篇文章主要介紹了Angular 中 select指令用法詳解的相關(guān)資料,本文介紹的非常詳細(xì),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2016-09-09
  • AngularJs Scope詳解及示例代碼

    AngularJs Scope詳解及示例代碼

    本文主要介紹AngularJs Scope的知識(shí),這里整理了詳細(xì)資料及示例代碼,有興趣的小伙伴可以參考下
    2016-09-09
  • AngularJS遍歷獲取數(shù)組元素的方法示例

    AngularJS遍歷獲取數(shù)組元素的方法示例

    這篇文章主要介紹了AngularJS遍歷獲取數(shù)組元素的方法,涉及AngularJS簡(jiǎn)單的數(shù)組遍歷及元素獲取相關(guān)操作技巧,需要的朋友可以參考下
    2017-11-11
  • Angular.JS中select下拉框設(shè)置value的方法

    Angular.JS中select下拉框設(shè)置value的方法

    select 是 AngularJS 預(yù)設(shè)的一組directive。下面這篇文章主要給大家介紹了關(guān)于Angular.JS中select下拉框設(shè)置value的方法,文中介紹的非常詳細(xì),對(duì)大家具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起看看吧。
    2017-06-06
  • 關(guān)于Angularjs中跨域設(shè)置白名單問(wèn)題

    關(guān)于Angularjs中跨域設(shè)置白名單問(wèn)題

    這篇文章主要介紹了Angularjs中關(guān)于跨域設(shè)置白名單問(wèn)題,需要的朋友可以參考下
    2018-04-04
  • Angular.Js中ng-include指令的使用與實(shí)現(xiàn)

    Angular.Js中ng-include指令的使用與實(shí)現(xiàn)

    ng-include 指令用于包含外部的 HTML 文件。包含的內(nèi)容將作為指定元素的子節(jié)點(diǎn)。下面這篇文章主要給大家介紹了Angular.Js中ng-include指令的使用與實(shí)現(xiàn)的相關(guān)資料,文中介紹的非常詳細(xì),需要的朋友們下面來(lái)一起看看吧。
    2017-05-05
  • 詳解angular部署到iis出現(xiàn)404解決方案

    詳解angular部署到iis出現(xiàn)404解決方案

    這篇文章主要介紹了詳解angular部署到iis出現(xiàn)404解決方案,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-08-08
  • Angular4綁定html內(nèi)容出現(xiàn)警告的處理方法

    Angular4綁定html內(nèi)容出現(xiàn)警告的處理方法

    這篇文章主要給大家介紹了關(guān)于Angular4綁定html內(nèi)容出現(xiàn)警告的處理方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。
    2017-11-11
  • Angular5中提取公共組件之radio list的實(shí)例代碼

    Angular5中提取公共組件之radio list的實(shí)例代碼

    這篇文章主要介紹了Angular5中提取公共組件之radio list的實(shí)例代碼,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2018-07-07
  • angular簡(jiǎn)介和其特點(diǎn)介紹

    angular簡(jiǎn)介和其特點(diǎn)介紹

    這篇文章主要介紹了angular簡(jiǎn)介和其特點(diǎn)介紹,本文講解了關(guān)于和jquery的比較、關(guān)于適用場(chǎng)合、關(guān)于UI的結(jié)合、關(guān)于angularjs的特點(diǎn)等內(nèi)容,需要的朋友可以參考下
    2015-01-01

最新評(píng)論