opened
sjclemmy
username_0
I have a service that contains a method that returns an object that contains methods:
```
/**
* @memberof module
* @name myService
* @ngdoc service
*/
function myService(){
 
 return {
  test: test
} 

/**
* @memberof myService
*/
function test(){

/**
* @memberof myService
* @desc This is an obj
* @type {Object}
*/
 var obj = {
  prop1: '',
  testfunc: function (){
    //some stuff 
   }
  }
 }
}
```
How do define a description for `testfunc`?
How to document methods inside objects
issue
created
Zemke
username_1
You can’t. Actually there’s already a mistake in documenting `obj` as a member of `myService`–it’s not.

There’s a way to do something like that, though.

You can document `obj` explicitly using `@ngdoc type`:

```js
/**
 * @ngdoc type
 * @name YourObjectName
 * @memberof app
 *
 * @property {string} prop1 You could also document this string property
 * @property {function} testfunc Here you can document the function. :)
 */
```

Depending on what you want to do with `obj`, you could use `app.YourObjectName` as the return type (like `@returns {app.YourObjectName} description blah blah`) of a function or even declare `obj` with `@type {app.YourObjectName}` as opposed to `@type {Object}` in your example.

I hope this helps. :)
comment
closed
Zemke
username_1
issue
created
reloaded
username_2
According to JSDOC3 @memberof this should definitely be possible.

Quoting their @memberof basic example:
```
/** @namespace */
var Tools = {};

/** @memberof Tools */
var hammer = function() {
};

Tools.hammer = hammer;
```

Also you should be able to achieve this with the use of the @alias and @memberof!  (notice the exclamation point at the end of memberof).

http://usejsdoc.org/tags-memberof.html
comment
created
Zemke
username_1
Okay, I assumed it was of importance to keep it in the object definition and not use dot notation.
comment