Angular Dynamic meta tags in head

后端 未结 4 1982
再見小時候
再見小時候 2020-12-06 20:52

I need to insert open graph meta tags on a particular page in an angular app.

These tags are different based on the news or video that the page has.

I tried

4条回答
  •  渐次进展
    2020-12-06 21:22

    I was having a similar problem with Apple's Smart App Banner. You may be able to apply a similar logic if you are still looking for an answer.

    `
    
       myNews 
      
    
    

    I set up a service that populates the urlArgument with the id as per this answer., and used it in the page controller.

    module.controller('myNewsVideoCtrl', function($scope, $stateParams, $rootScope, openGraph ){
      $rootScope.opengraph = openGraph;
      $rootScope.opengraph.set("http://www.imdb.com/title/"+$stateParams.videoID);
    })
    

提交回复
热议问题