Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(ngdoc): add default values to ngdoc template
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Dag-Inge Aas authored and matsko committed Sep 30, 2013
1 parent 1618adf commit 448bd14
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions docs/src/ngdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -629,7 +629,6 @@ Doc.prototype = {
types = types.substr(0,limit);
}
types = types.split(/\|(?![\(\)\w\|\s]+>)/);
var description = param.description;
if (param.optional) {
name += ' <div><em>(optional)</em></div>';
}
Expand All @@ -642,8 +641,15 @@ Doc.prototype = {
dom.text(type);
dom.html('</a>');
}

dom.html('</td>');
dom.html('<td>' + description + '</td>');
var description = '<td>';
description += param.description;
if (param.default) {
description += ' <p><em>(default: ' + param.default + ')</em></p>';
}
description += '</td>';
dom.html(description);
dom.html('</tr>');
};
dom.html('</tbody>');
Expand Down

0 comments on commit 448bd14

Please sign in to comment.