-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help Please #1
Comments
Hi @totallytotallyamazing, thanks for trying out the module! Your angular.module('app', ['ngMeta'])
.run(function(ngMeta) {
//Makes ngMeta available in the module
}); That should fix it. P.S: I realise injecting ngMeta into the |
Hi Vinay, Also I wanted to tell you that I had some success adding ngMeta to my "main.js" controller: 'use strict';
angular.module('app')
.controller('MainCtrl', function ($scope, $route, ngMeta) {
$scope.awesomeThings = [
'HTML5 Boilerplate',
'AngularJS',
'Karma'
];
$scope.$route = $route;
ngMeta.setTitle('Home title');
ngMeta.setDescription('Home description');
}); Thank you, |
I've added the run block to your app.js code. Let me know if that solves your issue. angular
.module('app', [
'ngAnimate',
'ngAria',
'ngCookies',
'ngMessages',
'ngResource',
'ngRoute',
'ngSanitize',
'ngTouch',
'ngMeta'
])
.config(function ($routeProvider, ngMetaProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/index.dot.html',
controller: 'MainCtrl',
meta: {
title: 'Home title',
description: 'Home description'
}
})
.when('/about', {
templateUrl: 'views/about.html',
controller: 'AboutCtrl',
meta: {
title: 'about title',
description: 'about description'
}
})
.when('/contact', {
templateUrl: 'views/contact.html',
controller: 'ContactCtrl',
meta: {
title: 'contact title',
description: 'contact description'
}
})
.otherwise({
redirectTo: '/'
});
ngMetaProvider.setName('metaTags');
})
.run(function(ngMeta) {
}); |
I was able to get that code going without jshint errors but it didn't work. 'use strict';
angular.module('app')
.controller('MainCtrl', function ($scope, $route, ngMeta) {
$scope.awesomeThings = [
'HTML5 Boilerplate',
'AngularJS',
'Karma'
];
$scope.$route = $route;
ngMeta.setTitle('Home title');
ngMeta.setDescription('Home description');
}); |
is there anything to do that fixes this issue,, it cannot read anything from the .states configuration,, you have to set things in the controller |
@bdairy, are you sure the
At the moment, it's required for ngMeta to be instantiated and made available throughout your app. <pre>
Title = {{ngMeta.title | json}}
ngMeta object = {{ngMeta | json}}
</pre> |
@vinaygopinath please remove my post because it was a problem from my side and now it works like charm.. thanks for your fast response |
@bdairy No problem! Glad it works for you. @totallytotallyamazing Can you give it another go and see if you're unable to get ngMeta working through your $route configuration? Please make sure you have the |
I've added a link to the demo site. Please refer to the code there to set up ngMeta in your app. |
Hi Vinay,
Thanks for writing what seems to be some awesome code!
I am having some problems getting it going in my Grunt project and would appreciate your help please.
I added your "ngMeta" component via bower to my project build and updated my "bower.json" file like this:
Here's the my HTML5 meta tags:
Here's my JS Body links:
Here's my AngularJS app:
Here's my controller file "main.js":
Here's my controller file "about.js":
Here's my controller file "contact.js":
Please let me know if you need any further information or explaination.
Kind regards,
Derek
The text was updated successfully, but these errors were encountered: