Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit c27a56f

Browse files
committed
docs(scope): show which directives create scopes
1 parent fbcb7fd commit c27a56f

File tree

5 files changed

+45
-3
lines changed

5 files changed

+45
-3
lines changed

docs/spec/ngdocSpec.js

+20
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,26 @@ describe('ngdoc', function() {
349349
});
350350
});
351351

352+
describe('@scope', function() {
353+
it('should state the new scope will be created', function() {
354+
var doc = new Doc('@name a\n@scope');
355+
doc.ngdoc = 'directive';
356+
doc.parse();
357+
expect(doc.scope).toEqual('');
358+
expect(doc.html()).toContain('This directive creates new scope.');
359+
});
360+
});
361+
362+
describe('@priority', function() {
363+
it('should state the priority', function() {
364+
var doc = new Doc('@name a\n@priority 123');
365+
doc.ngdoc = 'directive';
366+
doc.parse();
367+
expect(doc.priority).toEqual('123');
368+
expect(doc.html()).toContain('This directive executes at priority level 123.');
369+
});
370+
});
371+
352372
describe('@property', function() {
353373
it('should parse @property tags into array', function() {
354374
var doc = new Doc("@name a\n@property {type} name1 desc\n@property {type} name2 desc");

docs/src/ngdoc.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ Doc.prototype = {
374374
dom.text('>\n ...\n');
375375
dom.text('</' + self.element + '>');
376376
});
377+
self.html_usage_directiveInfo(dom);
377378
self.html_usage_parameters(dom);
378379
});
379380
},
@@ -461,11 +462,25 @@ Doc.prototype = {
461462
});
462463
});
463464

465+
self.html_usage_directiveInfo(dom);
464466
self.html_usage_parameters(dom);
465-
self.html_usage_returns(dom);
466467
});
467468
},
468469

470+
html_usage_directiveInfo: function(dom) {
471+
var self = this;
472+
var list = [];
473+
474+
475+
if (self.scope !== undefined) {
476+
list.push('This directive creates new scope.');
477+
}
478+
if (self.priority !== undefined) {
479+
list.push('This directive executes at priority level ' + self.priority + '.');
480+
}
481+
dom.ul(list);
482+
},
483+
469484
html_usage_overview: function(dom){
470485
dom.html(this.description);
471486
},

src/directives.js

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ var ngInitDirective = valueFn({
5555
* service.
5656
*
5757
* @element ANY
58+
* @scope
5859
* @param {expression} expression Name of a globally accessible constructor function or an
5960
* {@link guide/dev_guide.expressions expression} that on the current scope evaluates to a
6061
* constructor function.

src/widget/form.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
'use strict';
22

33
/**
4-
* @ngdoc widget
4+
* @ngdoc directive
55
* @name angular.module.ng.$compileProvider.directive.form
66
*
7+
* @scope
78
* @description
89
* Angular widget that creates a form scope using the
910
* {@link angular.module.ng.$formFactory $formFactory} API. The resulting form scope instance is

src/widgets.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
* Keep in mind that Same Origin Policy applies to included resources
1111
* (e.g. ng:include won't work for file:// access).
1212
*
13+
* @scope
14+
*
1315
* @param {string} src angular expression evaluating to URL. If the source is a string constant,
1416
* make sure you wrap it in quotes, e.g. `src="'myPartialTemplate.html'"`.
1517
* @param {Scope=} [scope=new_child_scope] optional expression which evaluates to an
@@ -130,6 +132,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
130132
* ...
131133
* <any ng:switch-default>...</any>
132134
*
135+
* @scope
133136
* @param {*} on expression to match against <tt>ng:switch-when</tt>.
134137
* @paramDescription
135138
* On child elments add:
@@ -254,7 +257,7 @@ var htmlAnchorDirective = valueFn({
254257

255258

256259
/**
257-
* @ngdoc widget
260+
* @ngdoc directive
258261
* @name angular.module.ng.$compileProvider.directive.ng:repeat
259262
*
260263
* @description
@@ -273,6 +276,8 @@ var htmlAnchorDirective = valueFn({
273276
* Note: Although `ng:repeat` looks like a directive, it is actually an attribute widget.
274277
*
275278
* @element ANY
279+
* @scope
280+
* @priority 1000
276281
* @param {string} repeat_expression The expression indicating how to enumerate a collection. Two
277282
* formats are currently supported:
278283
*

0 commit comments

Comments
 (0)