From 448bd14445e7f8a8aabaa555d43bbf7dff50d58d Mon Sep 17 00:00:00 2001 From: Dag-Inge Aas Date: Tue, 10 Sep 2013 18:06:18 +0200 Subject: [PATCH] fix(ngdoc): add default values to ngdoc template ngDoc did not add default value to template, even though it was present in the documentation. This change adds the default value to the description column in the parameters table. Closes #3950 --- docs/src/ngdoc.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index 0eacada04964..0f94f6eba398 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -482,7 +482,7 @@ Doc.prototype = { description:self.markdown(text.replace(match[0], match[6])), type: optional ? match[1].substring(0, match[1].length-1) : match[1], optional: optional, - 'default':match[5] + default: match[5] }; self.param.push(param); } else if (atName == 'returns' || atName == 'return') { @@ -629,7 +629,6 @@ Doc.prototype = { types = types.substr(0,limit); } types = types.split(/\|(?![\(\)\w\|\s]+>)/); - var description = param.description; if (param.optional) { name += '
(optional)
'; } @@ -642,8 +641,15 @@ Doc.prototype = { dom.text(type); dom.html(''); } + dom.html(''); - dom.html('' + description + ''); + var description = ''; + description += param.description; + if (param.default) { + description += '

(default: ' + param.default + ')

'; + } + description += ''; + dom.html(description); dom.html(''); }; dom.html('');