import { Injectable } from '@angular/core';
import { Headers, Http } from '@angular/http';
import 'rxjs/add/operator/toPromise';
import { Contact } from '../classes/contact';
/**
* Description for service 'ContactService'.
*/
@Injectable()
export class ContactService {
constructor(private http: Http) { }
}
Code comments
The documentation generator currently understands these javadoc tags:
@param <param name>
@return(s)
All other tags will be rendered as definition lists, so they are not lost.
Comment to some variable:
/**
* This is a doc comment for "someVar".
*/
var someVar:string = "value";
Function comments:
/**
* Comment for method ´doSomething´.
* @param target Comment for parameter ´target´.
* @param arg Comment for parameter ´arg´.
* @returns Comment for return value.
*/
function doSomething(target:any, arg:number):number {
return 0;
}
Modules comments
Modules can be commented like any other elements in TypeScript. As modules can be defined in multiple files, TypeDoc selects the longest comment by default. One may override this behaviour with the special@preferredcomment tag.
/**
* Actual module comment.
* @preferred
*/
module MyModule { }
/**
* Dismissed module comment.
* This is the longer comment but will be dismissed in favor of the preferred comment.
*/
module MyModule { }
HTML tags in comments
It is possible to use HTML tags in comments. For example:
/**
* Description with HTML tags.
*
* <pre>{
* 'firstName': 'John',
* 'lastName': 'Doe'
* }</pre>
*
* Link to: <a target="_blank" href="https://www.google.com/">Google</a>
*/