Reputation: 427
Iam trying to change the meta tags dynamically, iam using ngMeta tags but it is not working i mean there is no update in meta tags
here is my html code
<meta property="fb:app_id" content="{{facebookAppId}}">
<meta property="og:site_name" content="{{ngMeta.title}}">
<meta property="og:title" content="{{ngMeta.title}}">
<meta property="og:description" content="{{ngMeta.description}}">
<meta property="og:url" content="{{ngMeta.url}}">
<meta property="og:image" content="{{ngMeta.url}}">
<meta property="og:type" content="website">
here is controller code
angular.module('core').controller('HomeController',['$scope','ngMeta'],function($scope,ngMeta){
ngMeta.setTitle('Demo page');
ngMeta.setTag('description', 'This is the description of the demo page');
ngMeta.setTag('image', 'http://mobilemarketingwatch.com/wp-content/uploads/2016/05/Is-Google-Searching-for-the-Next-Big-Thing1.jpg');
});
here is my routes
angular.module('core').config(['$stateProvider', '$urlRouterProvider', 'ngMetaProvider',function ($stateProvider, $urlRouterProvider, ngMetaProvider) {
$stateProvider
.state('home', {
url: '/',
templateUrl: 'modules/core/client/views/home.html'
})
.state('aboutus', {
url: '/aboutus',
templateUrl: 'modules/core/client/views/about.html',
data: {
pageTitle: 'About '
}
});
}]).run(['ngMeta', function (ngMeta) {
ngMeta.init();
}]);
In home page also it not showing any title. please solve my problem
here is the image of my browser console
Upvotes: 0
Views: 1114
Reputation: 3509
This has nothing to do with dynamic meta tags or ngMeta. You haven't associated HomeController
with the home
state. Refer ui-router docs
.state('home', {
url: '/',
templateUrl: 'modules/core/client/views/home.html',
controller: 'HomeController'
})
Upvotes: 1