aboutsummaryrefslogtreecommitdiffstats
path: root/docs/app/src/directives.js
diff options
context:
space:
mode:
authorPeter Bacon Darwin2014-02-12 22:47:42 +0000
committerPeter Bacon Darwin2014-02-16 19:03:41 +0000
commit389d4879da4aa620ee95d789b19ff9be44eb730a (patch)
tree93352ddc8738a975904a1774d51b93d585ca1075 /docs/app/src/directives.js
parenta564160511bf1bbed5a4fe5d2981fae1bb664eca (diff)
downloadangular.js-389d4879da4aa620ee95d789b19ff9be44eb730a.tar.bz2
chore(doc-gen): new docs
chore(doc-gen): implement dgeni
Diffstat (limited to 'docs/app/src/directives.js')
-rw-r--r--docs/app/src/directives.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/app/src/directives.js b/docs/app/src/directives.js
new file mode 100644
index 00000000..15bef69b
--- /dev/null
+++ b/docs/app/src/directives.js
@@ -0,0 +1,35 @@
+angular.module('directives', [])
+
+.directive('code', function() {
+ return { restrict:'E', terminal: true };
+})
+
+/**
+ * backToTop Directive
+ * @param {Function} $anchorScroll
+ *
+ * @description Ensure that the browser scrolls when the anchor is clicked
+ */
+.directive('backToTop', ['$anchorScroll', function($anchorScroll) {
+ return function link(scope, element) {
+ element.on('click', function(event) {
+ scope.$apply($anchorScroll);
+ });
+ };
+}])
+
+
+.directive('code', function() {
+ return {
+ restrict: 'E',
+ terminal: true,
+ compile: function(element) {
+ var linenums = element.hasClass('linenum') || element.parent()[0].nodeName === 'PRE';
+ var match = /lang-(\S)+/.exec(element.className);
+ var lang = match && match[1];
+ var html = element.html();
+ element.html(window.prettyPrintOne(html, lang, linenums));
+ }
+ };
+});
+