Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Typescript and ngdoc w/ angular 1? #215

Open
pselden opened this issue Apr 11, 2017 · 1 comment
Open

[Question] Typescript and ngdoc w/ angular 1? #215

pselden opened this issue Apr 11, 2017 · 1 comment

Comments

@pselden
Copy link

pselden commented Apr 11, 2017

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.

@chriscasola
Copy link

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);
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants