2014-04-24 61 views
0

我正在使用angular-seo ,但它不呈現UI-view內容 。angular-seo不呈現ui視圖內容

我的設置:

.config(function($locationProvider,$stateProvider) { 
    $urlRouterProvider.otherwise('/'); 
    $locationProvider.html5Mode(true); 
    $stateProvider 
     .state('index', { 
      url: '/', 
      templateUrl: 'src/app/default/site/site.tpl.html', 
      controller: 'IndexCtrl' 
     }) 
     .state('blog', { 
      url: '/blog', 
      templateUrl: 'src/app/default/blog/blog.tpl.html', 
      resolve: { 
       posts: function(Post){ 
        return Post.all(); 
       } 
      }, 
      controller: 'BlogIndexCtrl' 
     }) 
}) 
<meta name="fragment" content="!" /> 
angular.module('app', ['seo']); 
.controller('BlogIndexCtrl', function ($scope,posts) { 
    $scope.posts = posts; 
    $scope.htmlReady(); 
}) 




phantomjs --disk-cache=no ~/vendor/angular-seo/angular-seo-server.js 5000 http://localhost 

但是當我運行

curl 'http://localhost:3000/?_escaped_fragment_=/blog' 

我只得到了HTML沒有腸子UI視角內容:(

什麼是錯

回答

2

您是否試過在$viewContentLoaded事件上放置$ scope.htmlReady?

+0

不錯的地方,但它不起作用我把它放在運行塊$ rootScope。$ on('$ viewContentLoaded',function(evt){//www.console.log(evt); $ rootScope.htmlReady(); }); – Whisher

+0

我不使用angular-seo(只是爲了小事),但看着[服務器端代碼](https://github.com/steeve/angular-seo/blob/master/angular-seo-server.js #L48)我認爲它只需要hashbang網址,並且它在html5Mode中不起作用。你可以嘗試沒有html5Mode,讓我知道嗎? – wilver

+0

這是很難改變代碼切換到#但是當我有一點時間我會嘗試它。謝謝關心:) – Whisher