我想让我的expressjs + angularjs SEO友好,我读了很多关于$ locationProvider的文章。我正在使用此代码,但我的应用程序无法运行并在浏览器中显示空白页面:
这是我的角度代码:
var myApp = angular.module("PlannerApp" , ['ngRoute' , 'appControllers' , 'ngAnimate']);
var appControllers = angular.module('appControllers' , []);
myApp.config(['$routeProvider' , '$locationProvider' , function($routeProvider , $routeProvider){
$routeProvider.
when("/home" ,
{templateUrl : "../home.html",
controller: 'HomepageCtrl'
}).
when("/about" ,
{templateUrl : "../about.html",
controller: 'AboutpageCtrl'
}).
otherwise({templateUrl : "../home.html"});
$locationProvider.html5Mode(true);
$locationProvider.hashPrefix('!');
}]);
function HomepageCtrl($scope) {
$scope.$parent.seo = {
pageTitle : 'home',
pageDescripton: 'home We are a content heavy website so we need to be indexed.'
};
}
function AboutpageCtrl($scope) {
$scope.$parent.seo = {
pageTitle : 'aboute ',
pageDescripton: 'aboute We are a content heavy website so we need to be indexed.'
};
}
myApp.run(function(){
console.log("runde");
});
这是输出:
答案 0 :(得分:0)