Skip to content

Commit 3b336f2

Browse files
Dag-Inge Aasjamesdaily
Dag-Inge Aas
authored andcommitted
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 angular#3950
1 parent c4c05c3 commit 3b336f2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

docs/src/ngdoc.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ Doc.prototype = {
482482
description:self.markdown(text.replace(match[0], match[6])),
483483
type: optional ? match[1].substring(0, match[1].length-1) : match[1],
484484
optional: optional,
485-
'default':match[5]
485+
default: match[5]
486486
};
487487
self.param.push(param);
488488
} else if (atName == 'returns' || atName == 'return') {
@@ -629,7 +629,6 @@ Doc.prototype = {
629629
types = types.substr(0,limit);
630630
}
631631
types = types.split(/\|(?![\(\)\w\|\s]+>)/);
632-
var description = param.description;
633632
if (param.optional) {
634633
name += ' <div><em>(optional)</em></div>';
635634
}
@@ -642,8 +641,15 @@ Doc.prototype = {
642641
dom.text(type);
643642
dom.html('</a>');
644643
}
644+
645645
dom.html('</td>');
646-
dom.html('<td>' + description + '</td>');
646+
var description = '<td>';
647+
description += param.description;
648+
if (param.default) {
649+
description += ' <p><em>(default: ' + param.default + ')</em></p>';
650+
}
651+
description += '</td>';
652+
dom.html(description);
647653
dom.html('</tr>');
648654
};
649655
dom.html('</tbody>');

0 commit comments

Comments
 (0)