Skip to content

Commit

Permalink
docs(*): fix heading levels; use @example instead of headings
Browse files Browse the repository at this point in the history
This ensures the doc-gen creates correct headlines and
table of contents entries.
  • Loading branch information
Narretz committed Oct 5, 2017
1 parent f05f548 commit e5c6174
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 35 deletions.
9 changes: 4 additions & 5 deletions src/auto/injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function annotate(fn, strictDi, name) {
* function is invoked. There are three ways in which the function can be annotated with the needed
* dependencies.
*
* ## Argument names
* #### Argument names
*
* The simplest form is to extract the dependencies from the arguments of the function. This is done
* by converting the function into a string using `toString()` method and extracting the argument
Expand All @@ -284,7 +284,7 @@ function annotate(fn, strictDi, name) {
* This method does not work with code minification / obfuscation. For this reason the following
* annotation strategies are supported.
*
* ## The `$inject` property
* #### The `$inject` property
*
* If a function has an `$inject` property and its value is an array of strings, then the strings
* represent names of services to be injected into the function.
Expand All @@ -300,7 +300,7 @@ function annotate(fn, strictDi, name) {
* expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
* ```
*
* ## The array notation
* #### The array notation
*
* It is often desirable to inline Injected functions and that's when setting the `$inject` property
* is very inconvenient. In these situations using the array notation to specify the dependencies in
Expand Down Expand Up @@ -360,8 +360,7 @@ function annotate(fn, strictDi, name) {
* You can use {@link $injector#modules `$injector.modules`} to check whether a module has been loaded
* into the injector, which may indicate whether the script has been executed already.
*
* ## Example
*
* @example
* Here is an example of loading a bundle of modules, with a utility method called `getScript`:
*
* ```javascript
Expand Down
4 changes: 2 additions & 2 deletions src/ng/directive/ngModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ NgModelController.prototype = {
* input which may have such events pending. This is important in order to make sure that the
* input field will be updated with the new model value and any pending operations are cancelled.
*
* @example
* <example name="ng-model-cancel-update" module="cancel-update-example">
* <file name="app.js">
* angular.module('cancel-update-example', [])
Expand Down Expand Up @@ -906,8 +907,7 @@ NgModelController.prototype = {
* This function can be used when the `$viewValue` or the rendered DOM value are not correctly
* formatted and the `$modelValue` must be run through the `$formatters` again.
*
* #### Example
*
* @example
* Consider a text input with an autocomplete list (for fruit), where the items are
* objects with a name and an id.
* A user enters `ap` and then selects `Apricot` from the list.
Expand Down
28 changes: 13 additions & 15 deletions src/ng/directive/ngNonBindable.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,29 @@
* @name ngNonBindable
* @restrict AC
* @priority 1000
* @element ANY
*
* @description
* The `ngNonBindable` directive tells AngularJS not to compile or bind the contents of the current
* DOM element. This is useful if the element contains what appears to be AngularJS directives and
* bindings but which should be ignored by AngularJS. This could be the case if you have a site that
* displays snippets of code, for instance.
*
* @element ANY
*
* @example
* In this example there are two locations where a simple interpolation binding (`{{}}`) is present,
* but the one wrapped in `ngNonBindable` is left alone.
*
* @example
<example name="ng-non-bindable">
<file name="index.html">
<div>Normal: {{1 + 2}}</div>
<div ng-non-bindable>Ignored: {{1 + 2}}</div>
</file>
<file name="protractor.js" type="protractor">
it('should check ng-non-bindable', function() {
expect(element(by.binding('1 + 2')).getText()).toContain('3');
expect(element.all(by.css('div')).last().getText()).toMatch(/1 \+ 2/);
});
</file>
</example>
<example name="ng-non-bindable">
<file name="index.html">
<div>Normal: {{1 + 2}}</div>
<div ng-non-bindable>Ignored: {{1 + 2}}</div>
</file>
<file name="protractor.js" type="protractor">
it('should check ng-non-bindable', function() {
expect(element(by.binding('1 + 2')).getText()).toContain('3');
expect(element.all(by.css('div')).last().getText()).toMatch(/1 \+ 2/);
});
</file>
</example>
*/
var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
8 changes: 4 additions & 4 deletions src/ng/directive/ngRepeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* </div>
*
*
* # Iterating over object properties
* ## Iterating over object properties
*
* It is possible to get `ngRepeat` to iterate over the properties of an object using the following
* syntax:
Expand Down Expand Up @@ -60,7 +60,7 @@
* or implement a `$watch` on the object yourself.
*
*
* # Tracking and Duplicates
* ## Tracking and Duplicates
*
* `ngRepeat` uses {@link $rootScope.Scope#$watchCollection $watchCollection} to detect changes in
* the collection. When a change happens, `ngRepeat` then makes the corresponding changes to the DOM:
Expand Down Expand Up @@ -140,7 +140,7 @@
* ```
*
*
* # Special repeat start and end points
* ## Special repeat start and end points
* To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending
* the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.
* The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on)
Expand Down Expand Up @@ -249,7 +249,7 @@
* @example
* This example uses `ngRepeat` to display a list of people. A filter is used to restrict the displayed
* results by name or by age. New (entering) and removed (leaving) items are animated.
<example module="ngRepeat" name="ngRepeat" deps="angular-animate.js" animations="true" name="ng-repeat">
<example module="ngRepeat" name="ngRepeat" deps="angular-animate.js" animations="true">
<file name="index.html">
<div ng-controller="repeatController">
I have {{friends.length}} friends. They are:
Expand Down
5 changes: 4 additions & 1 deletion src/ng/directive/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ var SelectController =
* </file>
*</example>
*
* @example
* ### Using `ngRepeat` to generate `select` options
* <example name="select-ngrepeat" module="ngrepeatSelect">
* <file name="index.html">
Expand Down Expand Up @@ -629,6 +630,7 @@ var SelectController =
* </file>
*</example>
*
* @example
* ### Using `ngValue` to bind the model to an array of objects
* <example name="select-ngvalue" module="ngvalueSelect">
* <file name="index.html">
Expand Down Expand Up @@ -661,6 +663,7 @@ var SelectController =
* </file>
*</example>
*
* @example
* ### Using `select` with `ngOptions` and setting a default value
* See the {@link ngOptions ngOptions documentation} for more `ngOptions` usage examples.
*
Expand Down Expand Up @@ -692,7 +695,7 @@ var SelectController =
* </file>
*</example>
*
*
* @example
* ### Binding `select` to a non-string value via `ngModel` parsing / formatting
*
* <example name="select-with-non-string-options" module="nonStringSelect">
Expand Down
8 changes: 4 additions & 4 deletions src/ng/rootScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function $RootScopeProvider() {
*
*
*
* #### Example
* @example
* ```js
// let's assume that scope was dependency injected as the $rootScope
var scope = $rootScope;
Expand Down Expand Up @@ -541,7 +541,7 @@ function $RootScopeProvider() {
* adding, removing, and moving items belonging to an object or array.
*
*
* #### Example
* @example
* ```js
$scope.names = ['igor', 'matias', 'misko', 'james'];
$scope.dataCount = 4;
Expand Down Expand Up @@ -743,7 +743,7 @@ function $RootScopeProvider() {
*
* In unit tests, you may need to call `$digest()` to simulate the scope life cycle.
*
* #### Example
* @example
* ```js
var scope = ...;
scope.name = 'misko';
Expand Down Expand Up @@ -972,7 +972,7 @@ function $RootScopeProvider() {
* the expression are propagated (uncaught). This is useful when evaluating AngularJS
* expressions.
*
* #### Example
* @example
* ```js
var scope = ng.$rootScope.Scope();
scope.a = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/ngAnimate/animateCss.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var ANIMATE_TIMER_KEY = '$$animateCss';
* Note that only browsers that support CSS transitions and/or keyframe animations are capable of
* rendering animations triggered via `$animateCss` (bad news for IE9 and lower).
*
* ## Usage
* ## General Use
* Once again, `$animateCss` is designed to be used inside of a registered JavaScript animation that
* is powered by ngAnimate. It is possible to use `$animateCss` directly inside of a directive, however,
* any automatic control over cancelling animations and/or preventing animations from being run on
Expand Down
2 changes: 1 addition & 1 deletion src/ngMock/angular-mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -2472,7 +2472,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
*
* Afterwards, bootstrap your app with this new module.
*
* ## Example
* @example
* <example name="httpbackend-e2e-testing" module="myAppE2E" deps="angular-mocks.js">
* <file name="app.js">
* var myApp = angular.module('myApp', []);
Expand Down
4 changes: 2 additions & 2 deletions src/ngRoute/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var noop;
* The `ngRoute` module provides routing and deeplinking services and directives for AngularJS apps.
*
* ## Example
* See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
* See {@link ngRoute.$route#examples $route} for an example of configuring and using `ngRoute`.
*
*/
/* global -ngRouteModule */
Expand All @@ -43,7 +43,7 @@ var isEagerInstantiationEnabled;
* Used for configuring routes.
*
* ## Example
* See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
* See {@link ngRoute.$route#examples $route} for an example of configuring and using `ngRoute`.
*
* ## Dependencies
* Requires the {@link ngRoute `ngRoute`} module to be installed.
Expand Down

0 comments on commit e5c6174

Please sign in to comment.