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

Commit 83a12a5

Browse files
docs(examples): give all examples a name
Closes #14958
1 parent 9fdb4f8 commit 83a12a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+117
-117
lines changed

docs/content/error/ngModel/numfmt.ngdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ In this example, our model stores the number as a string, so we provide the `str
2020
directive to convert it into the format the `input[number]` directive expects.
2121

2222

23-
<example module="numfmt-error-module">
23+
<example module="numfmt-error-module" name="number-format-error">
2424
<file name="index.html">
2525
<table>
2626
<tr ng-repeat="x in ['0', '1']">

docs/content/guide/$location.ngdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ then uses the information it obtains to compose hashbang URLs (such as
834834
Because `$location` uses getters/setters, you can use `ng-model-options="{ getterSetter: true }"`
835835
to bind it to `ngModel`:
836836

837-
<example module="locationExample">
837+
<example module="locationExample" name="location-two-way-binding">
838838
<file name="index.html">
839839
<div ng-controller="LocationController">
840840
<input type="text" ng-model="locationPath" ng-model-options="{ getterSetter: true }" />

docs/content/guide/accessibility.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ attributes (if they have not been explicitly specified by the developer):
6262

6363
### Example
6464

65-
<example module="ngAria_ngModelExample" deps="angular-aria.js">
65+
<example module="ngAria_ngModelExample" deps="angular-aria.js" name="accessibility-ng-model">
6666
<file name="index.html">
6767
<form ng-controller="formsController">
6868
<some-checkbox role="checkbox" ng-model="checked" ng-class="{active: checked}"
@@ -331,7 +331,7 @@ The attribute magic of ngAria may not work for every scenario. To disable indivi
331331
you can use the {@link ngAria.$ariaProvider#config config} method. Just keep in mind this will
332332
tell ngAria to ignore the attribute globally.
333333

334-
<example module="ngAria_ngClickExample" deps="angular-aria.js">
334+
<example module="ngAria_ngClickExample" deps="angular-aria.js" name="accessibility-ng-click">
335335
<file name="index.html">
336336
<div ng-click="someFunction" show-attrs>
337337
&lt;div&gt; with ng-click and bindRoleForClick, tabindex set to false

docs/content/guide/animations.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Animations are not available unless you include the {@link ngAnimate `ngAnimate`
2323

2424
Below is a quick example of animations being enabled for `ngShow` and `ngHide`:
2525

26-
<example module="ngAnimate" deps="angular-animate.js" animations="true">
26+
<example module="ngAnimate" deps="angular-animate.js" animations="true" name="animate-ng-show">
2727
<file name="index.html">
2828
<div ng-init="checked = true">
2929
<label>
@@ -188,7 +188,7 @@ able to capture class changes if an **expression** or the **ng-class** directive
188188

189189
The example below shows how to perform animations during class changes:
190190

191-
<example module="ngAnimate" deps="angular-animate.js" animations="true">
191+
<example module="ngAnimate" deps="angular-animate.js" animations="true" name="animate-css-class">
192192
<file name="index.html">
193193
<p>
194194
<input type="button" value="set" ng-click="myCssVar='css-class'">

docs/content/guide/compiler.ngdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ to write directives.
7777
Here is a directive which makes any element draggable. Notice the `draggable` attribute on the
7878
`<span>` element.
7979

80-
<example module="drag">
80+
<example module="drag" name="draggable">
8181
<file name="script.js">
8282
angular.module('drag', []).
8383
directive('draggable', function($document) {

docs/content/guide/component.ngdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ but they are guaranteed to be available just before the `$onInit` method is exec
383383

384384
Here is a tab pane example built from components:
385385

386-
<example module="docsTabsExample">
386+
<example module="docsTabsExample" name="component-tabs-pane">
387387
<file name="script.js">
388388
angular.module('docsTabsExample', [])
389389
.component('myTabs', {

docs/content/guide/controller.ngdoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ The message in our template contains a binding to the `spice` model which, by de
132132
string "very". Depending on which button is clicked, the `spice` model is set to `chili` or
133133
`jalapeño`, and the message is automatically updated by data-binding.
134134

135-
<example module="spicyApp1">
135+
<example module="spicyApp1" name="controller-spicy-1">
136136
<file name="index.html">
137137
<div ng-controller="SpicyController">
138138
<button ng-click="chiliSpicy()">Chili</button>
@@ -173,7 +173,7 @@ its children).
173173
Controller methods can also take arguments, as demonstrated in the following variation of the
174174
previous example.
175175

176-
<example module="spicyApp2">
176+
<example module="spicyApp2" name="controller-spicy-2">
177177
<file name="index.html">
178178
<div ng-controller="SpicyController">
179179
<input ng-model="customSpice">
@@ -210,7 +210,7 @@ have access to properties and methods defined by Controllers higher up the hiera
210210
See [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes) for
211211
more information about scope inheritance.
212212

213-
<example module="scopeInheritance">
213+
<example module="scopeInheritance" name="controller-scope-inheritance">
214214
<file name="index.html">
215215
<div class="spicy">
216216
<div ng-controller="MainController">

docs/content/guide/directive.ngdoc

+14-14
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ The **normalization** process is as follows:
8080

8181
For example, the following forms are all equivalent and match the {@link ngBind} directive:
8282

83-
<example module="docsBindExample">
83+
<example module="docsBindExample" name="directive-bind">
8484
<file name="index.html">
8585
<div ng-controller="Controller">
8686
Hello <input ng-model='name'> <hr/>
@@ -185,7 +185,7 @@ several others. This is a good opportunity to use a directive to simplify your t
185185

186186
Let's create a directive that simply replaces its contents with a static template:
187187

188-
<example module="docsSimpleDirective">
188+
<example module="docsSimpleDirective" name="directive-simple">
189189
<file name="script.js">
190190
angular.module('docsSimpleDirective', [])
191191
.controller('Controller', ['$scope', function($scope) {
@@ -224,7 +224,7 @@ its own HTML file and load it with the `templateUrl` option.
224224
If you are familiar with `ngInclude`, `templateUrl` works just like it. Here's the same example
225225
using `templateUrl` instead:
226226

227-
<example module="docsTemplateUrlDirective">
227+
<example module="docsTemplateUrlDirective" name="directive-template-url">
228228
<file name="script.js">
229229
angular.module('docsTemplateUrlDirective', [])
230230
.controller('Controller', ['$scope', function($scope) {
@@ -258,7 +258,7 @@ element that the directive was called on, and an `attr` object associated with t
258258
function, since the template is requested before the scope is initialized.
259259
</div>
260260

261-
<example module="docsTemplateUrlDirective">
261+
<example module="docsTemplateUrlDirective" name="directive-template-url-fn">
262262
<file name="script.js">
263263
angular.module('docsTemplateUrlDirective', [])
264264
.controller('Controller', ['$scope', function($scope) {
@@ -307,7 +307,7 @@ These restrictions can all be combined as needed:
307307

308308
Let's change our directive to use `restrict: 'E'`:
309309

310-
<example module="docsRestrictDirective">
310+
<example module="docsRestrictDirective" name="directive-restrict">
311311
<file name="script.js">
312312
angular.module('docsRestrictDirective', [])
313313
.controller('Controller', ['$scope', function($scope) {
@@ -363,7 +363,7 @@ given scope.
363363
In its current implementation, we'd need to create a different controller each time in order to
364364
re-use such a directive:
365365

366-
<example module="docsScopeProblemExample">
366+
<example module="docsScopeProblemExample" name="directive-scope-problem">
367367
<file name="script.js">
368368
angular.module('docsScopeProblemExample', [])
369369
.controller('NaomiController', ['$scope', function($scope) {
@@ -405,7 +405,7 @@ What we want to be able to do is separate the scope inside a directive from the
405405
outside, and then map the outer scope to a directive's inner scope. We can do this by creating what
406406
we call an **isolate scope**. To do this, we can use a {@link $compile#-scope- directive's `scope`} option:
407407

408-
<example module="docsIsolateScopeDirective">
408+
<example module="docsIsolateScopeDirective" name="directive-isolate">
409409
<file name="script.js">
410410
angular.module('docsIsolateScopeDirective', [])
411411
.controller('Controller', ['$scope', function($scope) {
@@ -478,7 +478,7 @@ scope has another effect.
478478
We can show this by adding another property, `vojta`, to our scope and trying to access it from
479479
within our directive's template:
480480

481-
<example module="docsIsolationExample">
481+
<example module="docsIsolationExample" name="directive-isolate-2">
482482
<file name="script.js">
483483
angular.module('docsIsolationExample', [])
484484
.controller('Controller', ['$scope', function($scope) {
@@ -557,7 +557,7 @@ to call a handler on a regular basis. This is easier than using `$timeout` but a
557557
end-to-end testing, where we want to ensure that all `$timeout`s have completed before completing the test.
558558
We also want to remove the `$interval` if the directive is deleted so we don't introduce a memory leak.
559559

560-
<example module="docsTimeDirective">
560+
<example module="docsTimeDirective" name="directive-link">
561561
<file name="script.js">
562562
angular.module('docsTimeDirective', [])
563563
.controller('Controller', ['$scope', function($scope) {
@@ -633,7 +633,7 @@ wrap any arbitrary content.
633633

634634
To do this, we need to use the `transclude` option.
635635

636-
<example module="docsTransclusionDirective">
636+
<example module="docsTransclusionDirective" name="directive-transclude">
637637
<file name="script.js">
638638
angular.module('docsTransclusionDirective', [])
639639
.controller('Controller', ['$scope', function($scope) {
@@ -664,7 +664,7 @@ this option have access to the scope **outside** of the directive rather than in
664664
To illustrate this, see the example below. Notice that we've added a `link` function in `script.js`
665665
that redefines `name` as `Jeff`. What do you think the `{{name}}` binding will resolve to now?
666666

667-
<example module="docsTransclusionExample">
667+
<example module="docsTransclusionExample" name="directive-transclusion">
668668
<file name="script.js">
669669
angular.module('docsTransclusionExample', [])
670670
.controller('Controller', ['$scope', function($scope) {
@@ -714,7 +714,7 @@ arbitrary content.
714714
Next, we want to add buttons to this dialog box, and allow someone using the directive to bind their
715715
own behavior to it.
716716

717-
<example module="docsIsoFnBindExample">
717+
<example module="docsIsoFnBindExample" name="directive-transclusion-scope">
718718
<file name="script.js">
719719
angular.module('docsIsoFnBindExample', [])
720720
.controller('Controller', ['$scope', '$timeout', function($scope, $timeout) {
@@ -791,7 +791,7 @@ its elements.
791791
For instance, what if we wanted to create a directive that lets a user drag an
792792
element?
793793

794-
<example module="dragModule">
794+
<example module="dragModule" name="directive-drag">
795795
<file name="script.js">
796796
angular.module('dragModule', [])
797797
.directive('myDraggable', ['$document', function($document) {
@@ -848,7 +848,7 @@ Sometimes, you want a component that's built from a combination of directives.
848848
Imagine you want to have a container with tabs in which the contents of the container correspond
849849
to which tab is active.
850850

851-
<example module="docsTabsExample">
851+
<example module="docsTabsExample" name="directive-tabs">
852852
<file name="script.js">
853853
angular.module('docsTabsExample', [])
854854
.directive('myTabs', function() {

docs/content/guide/expression.ngdoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ the method from your view. If you want to `eval()` an Angular expression yoursel
5151
{@link ng.$rootScope.Scope#$eval `$eval()`} method.
5252

5353
## Example
54-
<example>
54+
<example name="expression-simple">
5555
<file name="index.html">
5656
<span>
5757
1+2={{1+2}}
@@ -67,7 +67,7 @@ the method from your view. If you want to `eval()` an Angular expression yoursel
6767

6868
You can try evaluating different expressions here:
6969

70-
<example module="expressionExample">
70+
<example module="expressionExample" name="expression-eval">
7171
<file name="index.html">
7272
<div ng-controller="ExampleController" class="expressions">
7373
Expression:
@@ -122,7 +122,7 @@ provide mockable access to globals.
122122
It is possible to access the context object using the identifier `this` and the locals object using the
123123
identifier `$locals`.
124124

125-
<example module="expressionExample">
125+
<example module="expressionExample" name="expression-locals">
126126
<file name="index.html">
127127
<div class="example2" ng-controller="ExampleController">
128128
Name: <input ng-model="name" type="text"/>
@@ -197,7 +197,7 @@ expose a `$event` object within the scope of that expression. The object is an i
197197
Event Object](http://api.jquery.com/category/events/event-object/) when jQuery is present or a
198198
similar jqLite object.
199199

200-
<example module="eventExampleApp">
200+
<example module="eventExampleApp" name="expression-events">
201201
<file name="index.html">
202202
<div ng-controller="EventController">
203203
<button ng-click="clickMe($event)">Event</button>
@@ -241,7 +241,7 @@ An expression that starts with `::` is considered a one-time expression. One-tim
241241
will stop recalculating once they are stable, which happens after the first digest if the expression
242242
result is a non-undefined value (see value stabilization algorithm below).
243243

244-
<example module="oneTimeBidingExampleApp">
244+
<example module="oneTimeBidingExampleApp" name="expression-one-time">
245245
<file name="index.html">
246246
<div ng-controller="EventController">
247247
<button ng-click="clickMe($event)">Click Me</button>

docs/content/guide/filter.ngdoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The example below therefore calls the filter directly in the controller.
6969
By this, the controller is able to call the filter only when needed (e.g. when the data is loaded from the backend
7070
or the filter expression is changed).
7171

72-
<example module="FilterInControllerModule">
72+
<example module="FilterInControllerModule" name="filter-in-controller">
7373
<file name="index.html">
7474
<div ng-controller="FilterController as ctrl">
7575
<div>
@@ -123,7 +123,7 @@ your filters, then you can use capitalization (`myappSubsectionFilterx`) or unde
123123
The following sample filter reverses a text string. In addition, it conditionally makes the
124124
text upper-case.
125125

126-
<example module="myReverseFilterApp">
126+
<example module="myReverseFilterApp" name="filter-reverse">
127127
<file name="index.html">
128128
<div ng-controller="MyController">
129129
<input ng-model="greeting" type="text"><br>
@@ -168,7 +168,7 @@ argument for the filter.
168168
If you however do need to write a stateful filter, you have to mark the filter as `$stateful`, which
169169
means that it will be executed one or more times during the each `$digest` cycle.
170170

171-
<example module="myStatefulFilterApp">
171+
<example module="myStatefulFilterApp" name="filter-stateful">
172172
<file name="index.html">
173173
<div ng-controller="MyController">
174174
Input: <input ng-model="greeting" type="text"><br>

docs/content/guide/forms.ngdoc

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The `ngModel` directive provides the two-way data-binding by synchronizing the m
2222
as well as view to the model. In addition it provides an {@link ngModel.NgModelController API}
2323
for other directives to augment its behavior.
2424

25-
<example module="formExample">
25+
<example module="formExample" name="forms-simple">
2626
<file name="index.html">
2727
<div ng-controller="ExampleController">
2828
<form novalidate class="simple-form">
@@ -84,7 +84,7 @@ with red background only after the input is blurred (loses focus).
8484
This ensures that the user is not distracted with an error until after interacting with the control,
8585
and failing to satisfy its validity.
8686

87-
<example module="formExample">
87+
<example module="formExample" name="forms-css-classes">
8888
<file name="index.html">
8989
<div ng-controller="ExampleController">
9090
<form novalidate class="css-form">
@@ -150,7 +150,7 @@ This allows us to extend the above example with these features:
150150
didn't interact with a control
151151

152152

153-
<example module="formExample">
153+
<example module="formExample" name="forms-custom-error-messages">
154154
<file name="index.html">
155155
<div ng-controller="ExampleController">
156156
<form name="form" class="css-form" novalidate>
@@ -232,7 +232,7 @@ I.e. `ng-model-options="{ updateOn: 'default blur' }"`
232232
The following example shows how to override immediate updates. Changes on the inputs within the form
233233
will update the model only when the control loses focus (blur event).
234234

235-
<example module="customTriggerExample">
235+
<example module="customTriggerExample" name="forms-custom-triggers">
236236
<file name="index.html">
237237
<div ng-controller="ExampleController">
238238
<form>
@@ -278,7 +278,7 @@ controls that inherit from it unless they are overridden.
278278
This example shows how to debounce model changes. Model will be updated only 250 milliseconds
279279
after last change.
280280

281-
<example module="debounceExample">
281+
<example module="debounceExample" name="forms-debounce">
282282
<file name="index.html">
283283
<div ng-controller="ExampleController">
284284
<form>
@@ -331,7 +331,7 @@ In the following example we create two directives:
331331
* A `username` directive that asynchronously checks if a user-entered value is already taken.
332332
We mock the server request with a `$q` deferred.
333333

334-
<example module="form-example1">
334+
<example module="form-example1" name="forms-async-validation">
335335
<file name="index.html">
336336
<form name="form" class="css-form" novalidate>
337337
<div>
@@ -421,7 +421,7 @@ in `input[email]` from a custom directive so that it requires a specific top-lev
421421
`example.com` to be present.
422422
Note that you can alternatively use `ng-pattern` to further restrict the validation.
423423

424-
<example module="form-example-modify-validators">
424+
<example module="form-example-modify-validators" name="forms-modify-validators">
425425
<file name="index.html">
426426
<form name="form" class="css-form" novalidate>
427427
<div>
@@ -474,7 +474,7 @@ See {@link guide/directive `$compileProvider.directive`} for more info.
474474

475475
The following example shows how to add two-way data-binding to contentEditable elements.
476476

477-
<example module="form-example2">
477+
<example module="form-example2" name="forms-custom-form-controls">
478478
<file name="index.html">
479479
<div contentEditable="true" ng-model="content" title="Click to edit">Some</div>
480480
<pre>model = {{content}}</pre>

docs/content/guide/module.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ should be bootstrapped. There are several advantages to this approach:
2727

2828
I'm in a hurry. How do I get a Hello World module working?
2929

30-
<example ng-app-included="true">
30+
<example ng-app-included="true" name="module-hello-world">
3131
<file name="index.html">
3232
<div ng-app="myApp">
3333
<div>
@@ -80,7 +80,7 @@ yourself when application grows.
8080

8181
The above is a suggestion. Tailor it to your needs.
8282

83-
<example module='xmpl'>
83+
<example module='xmpl' name="module-suggested-layout">
8484
<file name="index.html">
8585
<div ng-controller="XmplController">
8686
{{ greeting }}

0 commit comments

Comments
 (0)