angular-update-meta
Advanced tools
Comparing version 1.8.0 to 1.9.0
{ | ||
"name": "angular-update-meta", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ { |
@@ -44,3 +44,4 @@ // Create all modules and define dependencies to make sure they exist | ||
scheme: '@', | ||
property: '@' | ||
property: '@', | ||
itemprop: '@' | ||
}, | ||
@@ -62,2 +63,6 @@ link: function(scope, iElem, iAttrs) { | ||
if(scope.itemprop) { | ||
selector = 'meta[itemprop="' + scope.itemprop + '"]'; | ||
} | ||
// watch the content parameter and set the changing value as needed | ||
@@ -64,0 +69,0 @@ scope.$watch('content', function (newValue, oldValue) { |
@@ -1,1 +0,1 @@ | ||
angular.module("updateMeta",[]),function(){function t(t){function e(e,n,r){if(!document)return t.error("updateMeta: document is not available!"),void 0;if(!e)return t.error('updateMeta: Either of "name", "httpEquiv", "property" or "charset" must be provided!'),void 0;var u=document.querySelector(e);u&&u.setAttribute&&u.setAttribute(n,r)}return{restrict:"E",scope:{charset:"@",name:"@",content:"@",httpEquiv:"@",scheme:"@",property:"@"},link:function(t){var n;t.name&&(n='meta[name="'+t.name+'"]'),t.httpEquiv&&(n='meta[http-equiv="'+t.httpEquiv+'"]'),t.property&&(n='meta[property="'+t.property+'"]'),t.$watch("content",function(r){"undefined"!=typeof r&&e(n,"content",t.content)}),t.$watch("charset",function(n){"undefined"!=typeof n&&e("meta[charset]","charset",t.charset)})}}}t.$inject=["$log"],angular.module("updateMeta").directive("updateMeta",t)}(),function(){function t(){return{restrict:"E",scope:{title:"@"},link:function(t){t.$watch("title",function(t){"undefined"!=typeof t&&document&&(document.title=t)})}}}t.$inject=["$log"],angular.module("updateMeta").directive("updateTitle",t)}(); | ||
angular.module("updateMeta",[]),function(){function t(t){function e(e,n,r){if(!document)return t.error("updateMeta: document is not available!"),void 0;if(!e)return t.error('updateMeta: Either of "name", "httpEquiv", "property" or "charset" must be provided!'),void 0;var o=document.querySelector(e);o&&o.setAttribute&&o.setAttribute(n,r)}return{restrict:"E",scope:{charset:"@",name:"@",content:"@",httpEquiv:"@",scheme:"@",property:"@",itemprop:"@"},link:function(t){var n;t.name&&(n='meta[name="'+t.name+'"]'),t.httpEquiv&&(n='meta[http-equiv="'+t.httpEquiv+'"]'),t.property&&(n='meta[property="'+t.property+'"]'),t.itemprop&&(n='meta[itemprop="'+t.itemprop+'"]'),t.$watch("content",function(r){"undefined"!=typeof r&&e(n,"content",t.content)}),t.$watch("charset",function(n){"undefined"!=typeof n&&e("meta[charset]","charset",t.charset)})}}}t.$inject=["$log"],angular.module("updateMeta").directive("updateMeta",t)}(),function(){function t(){return{restrict:"E",scope:{title:"@"},link:function(t){t.$watch("title",function(t){"undefined"!=typeof t&&document&&(document.title=t)})}}}t.$inject=["$log"],angular.module("updateMeta").directive("updateTitle",t)}(); |
{ | ||
"name": "angular-update-meta", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"main": "dist/update-meta.js", | ||
"author": { | ||
@@ -5,0 +6,0 @@ "name": "Jurgen Van de Moere", |
@@ -11,2 +11,3 @@ # Update meta tags in AngularJS | ||
- supports [Open Graph protocol](http://ogp.me/) meta elements | ||
- supports [schema.org protocol](http://schema.org/) meta elements | ||
- update your document title dynamically | ||
@@ -16,2 +17,4 @@ - update your meta tags depending on the state your application is in | ||
View [example plunk right here](http://plnkr.co/edit/YgvUohn0zUZUOSroPyWk?p=preview). | ||
## Usage | ||
@@ -41,4 +44,5 @@ | ||
<meta property="og:title" content="The Rock" /> | ||
<meta itemprop="description" content="Application wide description for Schema.org (Google+ uses this)"> | ||
</head> | ||
<body> | ||
<body ng-app="yourApp"> | ||
... | ||
@@ -57,2 +61,3 @@ </body> | ||
<update-meta property="og:title" content="Minions"></update-meta> | ||
<update-meta itemprop="description" content="A page specific itemprop description"></update-meta> | ||
``` | ||
@@ -70,4 +75,5 @@ | ||
<meta property="og:title" content="Minions" /> | ||
<meta itemprop="description" content="A page specific itemprop description"> | ||
</head> | ||
<body> | ||
<body ng-app="yourApp"> | ||
... | ||
@@ -120,2 +126,7 @@ </body> | ||
### 1.9.0 | ||
- added support for itemprop (thank you @urbgimtam) | ||
- added examples for itemprop | ||
### 1.8.0 | ||
@@ -122,0 +133,0 @@ |
@@ -37,3 +37,4 @@ (function(){ | ||
scheme: '@', | ||
property: '@' | ||
property: '@', | ||
itemprop: '@' | ||
}, | ||
@@ -55,2 +56,6 @@ link: function(scope, iElem, iAttrs) { | ||
if(scope.itemprop) { | ||
selector = 'meta[itemprop="' + scope.itemprop + '"]'; | ||
} | ||
// watch the content parameter and set the changing value as needed | ||
@@ -57,0 +62,0 @@ scope.$watch('content', function (newValue, oldValue) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
26664
443
186