-1
페이스 북 또는 메타 태그를 동적으로 업데이트하고 싶습니다. 나는 이런 식으로 설정 Angularjs Facebook og 메타 태그를 동적으로 업데이트 중입니다.
angular.module('App.Common')
.service('MetadataService', ['$window', function($window){
var self = this;
self.setMetaTags = function (tagData){
$window.document.ogdescription = tagData.ogdescription;
$window.document.ogname = tagData.ogname;
$window.document.ogimage = tagData.ogimage;
};
}]);
그리고 내 템플릿 파일에
: I는 각 서비스를 발견<meta property="og:title" name="ogname" content=""/>
<meta property="og:description" name="ogdescription" content=""/>
<meta property="og:image" name="ogimage" content=""/>
그리고 내 컨트롤러 중 하나에 :
angular.module('App.Common')
.controller('ArticleController', function (MetadataService){
MetadataService.setMetaTags({
ogname : 'some title',
ogdescription : 'some desc',
ogimage : 'some image'
});
});
이 업데이트되지 않습니다 메타 태그. 내가 틀린 곳을 모른다. 제 영어를 용서해주십시오.
감사