角SEO不会呈现UI视图内容 [英] angular-seo doesn't render the ui-view content

查看:158
本文介绍了角SEO不会呈现UI视图内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的角度,搜索引擎优化
但它不呈现
用户界面视图的内容。

I'm using angular-seo but it doesn't render the ui-view content.

我的设立:

.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没有肠子用户界面视图内容:(

I only get the html without the innner ui-view content :(

怎么了?

推荐答案

你有没有试图把$ scope.htmlReady上的 $ viewContentLoaded 事件?

Have you tried to put $scope.htmlReady on $viewContentLoaded event?

这篇关于角SEO不会呈现UI视图内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆