Skip to content

Commit f7fc02c

Browse files
author
K.C. Hunter
committed
Adding lesson 22 on ngDocs.
1 parent 8d3393b commit f7fc02c

6 files changed

Lines changed: 52 additions & 5 deletions

File tree

GruntFile.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ module.exports = function (grunt)
6060
}
6161
},
6262

63+
ngdocs: {
64+
all: ['src/resources/js/*.js']
65+
},
66+
6367
watch: {
6468
scripts: {
6569
files: ['src/resources/js/**/*.js'],
@@ -86,6 +90,7 @@ module.exports = function (grunt)
8690

8791
grunt.registerTask('build', 'Build the application',
8892
['sass:dev',
89-
'concat:dist', 'ngAnnotate:dist', 'concat:css', 'concat:move', 'concat:map'
93+
'concat:dist', 'ngAnnotate:dist', 'concat:css', 'concat:move', 'concat:map',
94+
'ngdocs'
9095
]);
9196
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"main": "index.js",
66
"dependencies": {
77
"bower": "~1.3.12",
8-
"grunt-cli": "~0.1.13"
8+
"grunt-cli": "~0.1.13",
9+
"grunt-ngdocs": "~0.2.6"
910
},
1011
"devDependencies": {
1112
"grunt-contrib-uglify": "~0.6.0",

src/angularjstutorial.annotated.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var app = angular.module('MyApp', ['ngRoute'])
44

5-
.controller("main", ['$scope', function ($scope)
5+
.controller("MainCtrl", ['$scope', function ($scope)
66
{
77
$scope.message = "I am an annotated message.";
88
}])

src/angularjstutorial.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var app = angular.module('MyApp', ['ngRoute'])
44

5-
.controller("main", function ($scope)
5+
.controller("MainCtrl", function ($scope)
66
{
77
$scope.message = "I am an annotated message.";
88
})

src/resources/js/a_app.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
/* use strict */
22

3+
/**
4+
* @ngdoc object
5+
* @name MyApp
6+
* @description
7+
*
8+
* This is the module for MyApp. It uses ngRoute.
9+
**/
10+
311
var app = angular.module('MyApp', ['ngRoute'])

src/resources/js/annotate.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,37 @@
1-
.controller("main", function ($scope)
1+
/**
2+
* @ngdoc controller
3+
* @name MyApp.controller:MainCtrl
4+
* @description
5+
*
6+
* This is the main controller. It creates a variable
7+
* "message" on the scope and defines it with a string.
8+
* <pre>
9+
10+
<div data-ng-controller="MainCtrl"></div>
11+
12+
* </pre>
13+
**/
14+
.controller("MainCtrl", function ($scope)
215
{
316
$scope.message = "I am an annotated message.";
17+
})
18+
19+
/**
20+
* @ngdoc directive
21+
* @name MyApp.directive:maindirective
22+
* @restrict A
23+
* @priority 1000
24+
* @description
25+
*
26+
* This is the main directive of the application. It
27+
* is restricted to attributes and uses the
28+
* Main Controller.
29+
**/
30+
.directive("maindirective", function ()
31+
{
32+
return {
33+
restrict: 'A',
34+
transclude: false,
35+
controller: 'MainCtrl'
36+
}
437
})

0 commit comments

Comments
 (0)