2014-04-24 60 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