Skip to content

Instantly share code, notes, and snippets.

@nerdfiles
Created May 13, 2017 05:00
Show Gist options
  • Select an option

  • Save nerdfiles/8876fb4d74431331f9cc7913e7edcc2f to your computer and use it in GitHub Desktop.

Select an option

Save nerdfiles/8876fb4d74431331f9cc7913e7edcc2f to your computer and use it in GitHub Desktop.

AngularJS ngdocs examples

Module

/**
  * @ngdoc overview
  * @name Dashboard
  * @description Main module of the application
  */
angular.module('Dashboard', []);

Controller

/**
 * @ngdoc controller
 * @name Dashboard.controller:myController
 * @description Controller of the Dashboard
 */
angular.module('Dashboard', []).controller('myController', function(){});

Directive

/**
 * @ngdoc directive
 * @name Dashboard.directive:myDirective
 * @restrict EA
 * @description Directive of the Dashboard
 */
angular.module('Dashboard', []).directive('myDirective', function(){});

Filter

/**
 * @ngdoc filter
 * @name Dashboard.filter:myFilter
 * @description My filter
 */
angular.module('Dashboard', []).filter('myFilter', function(){});

Service

/**
 * @ngdoc service
 * @name Dashboard.service:myService
 * @description My Service
 */
angular.module('Dashboard', []).service('myService', function(){});

Provider

/**
 * @ngdoc service
 * @name Dashboard.service:myServiceProvider
 * @description My Provider
 */
angular.module('Dashboard', []).provider('myProvider', function(){});

Factory

/**
 * @ngdoc service
 * @name Dashboard.service:myFactory
 * @description My Factory
 */
angular.module('Dashboard', []).factory('myFactory', function(){});

Value

/**
 * @ngdoc service
 * @name Dashboard.service:myValue
 * @description My Value
 */
angular.module('Dashboard', []).value('myValue', 42);

Constant

/**
 * @ngdoc service
 * @name Dashboard.service:myConstant
 * @description My Constant
 */
angular.module('Dashboard', []).constant('myConstant', 42);

Method

/**
 * @ngdoc method
 * @name methodName
 * @methodOf Dashboard.service:myService
 * @description This method will return a list of users
 * @param {Boolean} boolParam Boolean flag to indicate something
 * @returns {Array} List of users
 */
this.getUsers = function (boolParam) {
    return users;
}

Property

/**
 * @ngdoc property
 * @name propertyName
 * @propertyOf Dashboard.service:myService
 * @returns {String} Name of the module
 */
appName: 'Dashboard',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment