dgeni-packages
dgeni-packages copied to clipboard
[Question] Typescript and ngdoc w/ angular 1?
I've started to mix in typescript to my angular 1 library and I'm having trouble getting ngdoc files written in typescript to show up in my documentation.
/**
* @ngdoc service
* @module ox.components.modals
* @name oxModalsService
* @description
* Service used to instantiate/open various types of modals. This is the main entry point for creating a modal, and it provides several convenience methods for configuring basic, preset modals.
*/
export default class OxModalsService {
/**
* @ngdoc method
* @name oxModalsService#open
*
* @description
* Instantiates and opens modal, with optional configuration, then returns the modal instance for later use.
*
*/
open(config: IOxModalConfig): OxModal {
}
}
}
When I run this with dgeni with typescript processor configured like:
.config(function(readTypeScriptModules) {
readTypeScriptModules.basePath = '.';
readTypeScriptModules.sourceFiles = [
'src/**/*.ts'
];
})
I get the following:
warn: Missing container document: "oxModalsService" - doc "oxModalsService#method:open" (method) - from file "src/components/modals/modals.service.ts"
The description of oxModalsService shows up but the individual methods do not.
I'm using the following in my packages:
require('dgeni-packages/ngdoc'),
require('dgeni-packages/examples'),
require('dgeni-packages/nunjucks'),
require('dgeni-packages/typescript')
Any ideas?
I noticed that in the aliases for the doc it says "default" as the first alias.
I got it working by adding a factory like this:
.factory('tsngFileReader', function (jsdocFileReader) {
return {
name: 'tsngFileReader',
defaultPattern: /\.ts$/,
getDocs: jsdocFileReader.getDocs
};
})
And then adding the file reader:
.config(function (readFilesProcessor, writeFilesProcessor, log, tsngFileReader) {
// scrape .ts files for ngdoc comments
readFilesProcessor.fileReaders.push(tsngFileReader);
})