AngularJS Single page app with dynamic meta – AngularJS SEO

AngularJS Single page app with dynamic meta – AngularJS SEO

Welcome to the In infinityknow.com website! You will Step By Step learn web programming, easy and very fun. This website allmost provides you with a complete web programming tutorial presented in an easy-to-follow manner. Each web programming tutorial has all the practical examples with web programming script and screenshots available.

READ :  C# Dynamically n numbers Sum

Dynamic meta tags for your Angular single page application. Update meta tags based on the current route/state of your app. Supports ui-router and ngRoute

ngMeta is available for download on Bower and NPM. You can also download the source/minified JS file from GitHub

Step 1 : Simple Download ngMeta click Link

[php]
bower install –save ngMeta //save here libs
[/php]

Check out the Download section for other alternat download options (NPM file, JS file here below)

  • Bower
    bower install –save ngMeta
  • npm
    npm install –save ng-meta
  • CDN
    [php]
    https://cdnjs.cloudflare.com/ajax/libs/ng-meta/1.0.0/ngMeta.min.js
    [/php]

Stpe 2 : Simple Add ‘ngMeta’ directives as a project dependency in AngularJS

[php]
angular.module(‘infinityknowApp’, [….,’ngMeta’]);
[/php]

READ :  simple file upload component using VueJs

Stpe 3 : Add All the meta tags to your app.js / main.js routes/states

[php]
angular.module(‘infinityknowApp’, [….,’ngRoute’,’ngMeta’])
.config(function($routeProvider) {
$routeProvider
.when(‘/’, {
templateUrl: ‘views/home.html’,
controller: ‘wayHomeCtrl’,
data: {
meta: {
‘title’: ‘Home page – infinityknow.com’,
‘description’: ‘Dynamic meta tags in your Angular SPA’
}
}
})
.when(‘/about’, {
templateUrl: ‘views/about.html’,
controller: ‘wayAboutCtrl’,
data: {
meta: {
‘title’: ‘About Us – infinityknow.com’,
‘description’: ‘Dynamic meta tags in your Angular SPA’
}
}
})

});
[/php]

Stpe 4 :Initialize ngMeta using the run block

[php]
angular.module(‘infinityknowApp’, [….,’ngMeta’])
.config(function(…) {

//your all routeProvider codes
})
.run(function(ngMeta) {
ngMeta.init();
//init function all call
});
[/php]
Example

Stpe 5 :Use meta tags in your HTML file

[php]

{{ngMeta.title}}

[/php]

Example

We hope you get an idea about AngularJS Single page app with dynamic meta – AngularJS SEO
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

READ :  vue js Login Form get http json data

We hope This Post can help you…….Good Luck!.

Leave a Comment