mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-25 22:33:44 +00:00
docs(scope): show which directives create scopes
This commit is contained in:
parent
fbcb7fdd14
commit
c27a56f4da
5 changed files with 45 additions and 3 deletions
|
|
@ -349,6 +349,26 @@ describe('ngdoc', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('@scope', function() {
|
||||||
|
it('should state the new scope will be created', function() {
|
||||||
|
var doc = new Doc('@name a\n@scope');
|
||||||
|
doc.ngdoc = 'directive';
|
||||||
|
doc.parse();
|
||||||
|
expect(doc.scope).toEqual('');
|
||||||
|
expect(doc.html()).toContain('This directive creates new scope.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('@priority', function() {
|
||||||
|
it('should state the priority', function() {
|
||||||
|
var doc = new Doc('@name a\n@priority 123');
|
||||||
|
doc.ngdoc = 'directive';
|
||||||
|
doc.parse();
|
||||||
|
expect(doc.priority).toEqual('123');
|
||||||
|
expect(doc.html()).toContain('This directive executes at priority level 123.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('@property', function() {
|
describe('@property', function() {
|
||||||
it('should parse @property tags into array', function() {
|
it('should parse @property tags into array', function() {
|
||||||
var doc = new Doc("@name a\n@property {type} name1 desc\n@property {type} name2 desc");
|
var doc = new Doc("@name a\n@property {type} name1 desc\n@property {type} name2 desc");
|
||||||
|
|
|
||||||
|
|
@ -374,6 +374,7 @@ Doc.prototype = {
|
||||||
dom.text('>\n ...\n');
|
dom.text('>\n ...\n');
|
||||||
dom.text('</' + self.element + '>');
|
dom.text('</' + self.element + '>');
|
||||||
});
|
});
|
||||||
|
self.html_usage_directiveInfo(dom);
|
||||||
self.html_usage_parameters(dom);
|
self.html_usage_parameters(dom);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -461,11 +462,25 @@ Doc.prototype = {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
self.html_usage_directiveInfo(dom);
|
||||||
self.html_usage_parameters(dom);
|
self.html_usage_parameters(dom);
|
||||||
self.html_usage_returns(dom);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
html_usage_directiveInfo: function(dom) {
|
||||||
|
var self = this;
|
||||||
|
var list = [];
|
||||||
|
|
||||||
|
|
||||||
|
if (self.scope !== undefined) {
|
||||||
|
list.push('This directive creates new scope.');
|
||||||
|
}
|
||||||
|
if (self.priority !== undefined) {
|
||||||
|
list.push('This directive executes at priority level ' + self.priority + '.');
|
||||||
|
}
|
||||||
|
dom.ul(list);
|
||||||
|
},
|
||||||
|
|
||||||
html_usage_overview: function(dom){
|
html_usage_overview: function(dom){
|
||||||
dom.html(this.description);
|
dom.html(this.description);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ var ngInitDirective = valueFn({
|
||||||
* service.
|
* service.
|
||||||
*
|
*
|
||||||
* @element ANY
|
* @element ANY
|
||||||
|
* @scope
|
||||||
* @param {expression} expression Name of a globally accessible constructor function or an
|
* @param {expression} expression Name of a globally accessible constructor function or an
|
||||||
* {@link guide/dev_guide.expressions expression} that on the current scope evaluates to a
|
* {@link guide/dev_guide.expressions expression} that on the current scope evaluates to a
|
||||||
* constructor function.
|
* constructor function.
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ngdoc widget
|
* @ngdoc directive
|
||||||
* @name angular.module.ng.$compileProvider.directive.form
|
* @name angular.module.ng.$compileProvider.directive.form
|
||||||
*
|
*
|
||||||
|
* @scope
|
||||||
* @description
|
* @description
|
||||||
* Angular widget that creates a form scope using the
|
* Angular widget that creates a form scope using the
|
||||||
* {@link angular.module.ng.$formFactory $formFactory} API. The resulting form scope instance is
|
* {@link angular.module.ng.$formFactory $formFactory} API. The resulting form scope instance is
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@
|
||||||
* Keep in mind that Same Origin Policy applies to included resources
|
* Keep in mind that Same Origin Policy applies to included resources
|
||||||
* (e.g. ng:include won't work for file:// access).
|
* (e.g. ng:include won't work for file:// access).
|
||||||
*
|
*
|
||||||
|
* @scope
|
||||||
|
*
|
||||||
* @param {string} src angular expression evaluating to URL. If the source is a string constant,
|
* @param {string} src angular expression evaluating to URL. If the source is a string constant,
|
||||||
* make sure you wrap it in quotes, e.g. `src="'myPartialTemplate.html'"`.
|
* make sure you wrap it in quotes, e.g. `src="'myPartialTemplate.html'"`.
|
||||||
* @param {Scope=} [scope=new_child_scope] optional expression which evaluates to an
|
* @param {Scope=} [scope=new_child_scope] optional expression which evaluates to an
|
||||||
|
|
@ -130,6 +132,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
|
||||||
* ...
|
* ...
|
||||||
* <any ng:switch-default>...</any>
|
* <any ng:switch-default>...</any>
|
||||||
*
|
*
|
||||||
|
* @scope
|
||||||
* @param {*} on expression to match against <tt>ng:switch-when</tt>.
|
* @param {*} on expression to match against <tt>ng:switch-when</tt>.
|
||||||
* @paramDescription
|
* @paramDescription
|
||||||
* On child elments add:
|
* On child elments add:
|
||||||
|
|
@ -254,7 +257,7 @@ var htmlAnchorDirective = valueFn({
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ngdoc widget
|
* @ngdoc directive
|
||||||
* @name angular.module.ng.$compileProvider.directive.ng:repeat
|
* @name angular.module.ng.$compileProvider.directive.ng:repeat
|
||||||
*
|
*
|
||||||
* @description
|
* @description
|
||||||
|
|
@ -273,6 +276,8 @@ var htmlAnchorDirective = valueFn({
|
||||||
* Note: Although `ng:repeat` looks like a directive, it is actually an attribute widget.
|
* Note: Although `ng:repeat` looks like a directive, it is actually an attribute widget.
|
||||||
*
|
*
|
||||||
* @element ANY
|
* @element ANY
|
||||||
|
* @scope
|
||||||
|
* @priority 1000
|
||||||
* @param {string} repeat_expression The expression indicating how to enumerate a collection. Two
|
* @param {string} repeat_expression The expression indicating how to enumerate a collection. Two
|
||||||
* formats are currently supported:
|
* formats are currently supported:
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue