I am just starting to get to grip using grunt-ngdocs for my angular application and so far so good.
But I would now like to document some properties of another documented prperty in one of my controllers.
Consider the following code:
(function() {
'use strict';
/**
* @ngdoc controller
* @name app.mymodule.controller:MyController
* @description
* A Controller
*/
angular
.module('app.mymodule')
.controller('MyController', Controller);
Controller.$inject = ['someService', 'otherService', '$state'];
function Controller(someService, otherService, $state) {
/**
* @ngdoc property
* @name vm
* @propertyOf app.mymodule.controller:MyController
* @description
* A named variable for the `this` keyword representing the ViewModel
*/
var vm = this,
searchText;
vm.customerService = customerService;
vm.fetchCollection = fetchCollection;
vm.deleteCustomer = deleteCustomer;
initialise();
function initialise() {
//logic
}
/**
* @ngdoc
* @name fetchCollection
* @methodOf app.mymodule.controller:MyController
*
* @description
* Function to retrieve records from the backend service
* @example
* vm.fetchCollection(page, perPage);
* @param {int} page The number of the page of data to be retrieved
* @param {int} perPage The number of items per page to be retrieved
* @returns {object} The response object returned from a httpPromise
*/
function fetchCollection(page, perPage){
//logic
}
function deleteCustomer(model) {
//logic
}
})();
As you can see, I have some properties hanging off the vm variable which are typically references to functions defined in the controller.
Using the ngdocs\jsdocs documentation syntax above I can get the vm property to output in my documentation folder, but I am unsure how to document the properties of the vm object itself.
Is there a sensible or recommended way to do this? I did wonder about not documenting vm altogether and just document each of the vm.xxx separately, but I'm not so sure about this!
Thanks
It is not very clear in the documentation, but you have to use the hash in the name.
Try this.