-
Notifications
You must be signed in to change notification settings - Fork 57
@attr support with optional and default value syntax #73
Comments
This has been introduced with 1.4.0. Example: (function () {
'use strict';
/**
* @ngdoc directive
* @name appExampleDirective
* @memberof app
*
* @restrict AEC
* @scope {}
*
* @description
* Test
*
* @param {string} [x]
* @param {string} [y="nice"]
* @param {string} z
*
* @attr {string} [x]
* @attr {string} [y="nice"]
* @attr {string} z
*/
angular
.module('app')
.directive('appExampleDirective', appExampleDirective);
function appExampleDirective($timeout, ExampleDirective, ExampleDirectiveService, DATES) {
return {
restrict: 'AEC',
scope: {
filterColumn: '=',
valueType: '@',
pickerValue: '@',
initialValue: '=?',
physicalUnit: '=?'
},
link: linkFn
};
function linkFn(scope, elem, attr) {
/**
*
* @memberof app.appExampleDirective
* @param {string} [x]
* @param {string} [y="nice"]
* @param {string} z
* @returns {null}
*/
function test(x, y, z) {
return null;
}
}
}
})(); |
@Zemke I did notice that adding [x] and [x=string] did "work" in the sense that the attribute name was outputed to the "name" column. However, this issue (lack of details on my part) was meant to be an enhancement request to provide two additional columns and one change to the table. The additional columns would be:
The additional change would be to show the attribute/parameter name without brackets and the default value. Using the sample screenshots you provided above it would be nice if the "Name" columns said "x" and "y" instead of "[x]" and "[y='nice']", respectively. The end result I am envisioning for this request would be:
|
I do not have official plan to support extra column do the table. Please use description for that purpose; optional/required |
Are you open to accepting a PR for this, assuming it's not on your road map due to time constraints? |
I want to keep all table to have the same structure; name, type, and description, unless provided a good reason to make an exception. |
Most Angular JS directives have optional parameters with default values. JSDOC3 appears to support this detection so the templates should be updated so the directive "Attributes" table has two additional columns that specify optionality and default values.
The text was updated successfully, but these errors were encountered: