Show Menu
Cheatography

angular js ng-doc Cheat Sheet (DRAFT) by

quicksheet for ng-doc tags

This is a draft cheat sheet. It is a work in progress and is not finished yet.

jsdoc declar­ation

@name
the name of the ngdoc document
@param {type} name description
describes a parameter of a function
@returns {type} description
describes what a function returns
@requires
normally indicates that a JavaScript module is required; in an Angular service it is used to describe what other services this service relies on
@property
describes a property of an object
@description
used to provide a descri­ption of a component in markdown
@link
specifies a link to a URL or a type in the API reference
@example
specifies an example that will be formatted as a code block
@deprecated
specifies that the following code is deprecated and should not be used
@this
specifies what this refers to in the context of a documented function

ngdoc specific declar­ation

@ngdoc
specifies the type of thing being documented
overview | service | object | function | method | property | event | directive | filter | inputType | error | parameters | returns | this | directiveInfo
@scope
specifies that the documented directive will create a new scope
@priority
specifies the documented direct­ive's priority
@animations
specifies the animations that the documented directive supports
@restrict
specifies how directives should be shown in the usage section.
For example, for [E]lement, [A]ttr­ibute, and [C]lass, use
@restrict ECA
@methodOf
links a method to the object­/se­rvice where it is defined
@propertyOf
links a property to the object­/se­rvice where it is defined
@eventOf
links a method to the object­/se­rvice where it is defined
@eventType
specifies whether the event is emitted or broadcast
emit|b­roa­dcast

< example > tag

<example module="..." deps="..." animation="true|false">
  ...
  <file src="..." tag="..." name="...">
    ... <docs tag="...">...</docs> ...
  </file>
  ...
</example>

< doc:ex­ample > tag

<doc:example module="...">
  ...
  <doc:source>
    ...
    <script></script> <!-- Contents will be extracted into a script.js file -->
    ...
    <style></style> <!-- Contents will be extracted into a style.css file -->
    ...
  </doc:source>
  <doc:scenario>
    ...
  </doc:scenario>
</doc:example>
This tag also identifies a block of HTML that will define a runnable example. In this case it will contain <doc:source> to specify the application code and <doc:scenario> to specify the e2e scenario test code.
 

usage

/**
 * @ngdoc directive
 * @name global.directive:nameOfDirective
 * @scope
 * @restrict EAC
 *
 * @description
 * A description of the directive
 *
 * @param {object}  field   A field object
 *
 */

----------

/**
 * @ngdoc controller
 * @name dashboard.controller:ControllerName
 *
 * @description
 * A description of the controller, service or filter
 *
 */

----------

/**
 * @ngdoc method
 * @name methodName
 * @methodOf module.ControllerName
 * @description
 * Describe the method here...
 *
 * @param {string} Description of parameter
 * @returns {Array} The returned item...
 *
 */

Reference