@@ -80,7 +80,7 @@ The **normalization** process is as follows:
80
80
81
81
For example, the following forms are all equivalent and match the {@link ngBind} directive:
82
82
83
- <example module="docsBindExample">
83
+ <example module="docsBindExample" name="directive-bind" >
84
84
<file name="index.html">
85
85
<div ng-controller="Controller">
86
86
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
185
185
186
186
Let's create a directive that simply replaces its contents with a static template:
187
187
188
- <example module="docsSimpleDirective">
188
+ <example module="docsSimpleDirective" name="directive-simple" >
189
189
<file name="script.js">
190
190
angular.module('docsSimpleDirective', [])
191
191
.controller('Controller', ['$scope', function($scope) {
@@ -224,7 +224,7 @@ its own HTML file and load it with the `templateUrl` option.
224
224
If you are familiar with `ngInclude`, `templateUrl` works just like it. Here's the same example
225
225
using `templateUrl` instead:
226
226
227
- <example module="docsTemplateUrlDirective">
227
+ <example module="docsTemplateUrlDirective" name="directive-template-url" >
228
228
<file name="script.js">
229
229
angular.module('docsTemplateUrlDirective', [])
230
230
.controller('Controller', ['$scope', function($scope) {
@@ -258,7 +258,7 @@ element that the directive was called on, and an `attr` object associated with t
258
258
function, since the template is requested before the scope is initialized.
259
259
</div>
260
260
261
- <example module="docsTemplateUrlDirective">
261
+ <example module="docsTemplateUrlDirective" name="directive-template-url-fn" >
262
262
<file name="script.js">
263
263
angular.module('docsTemplateUrlDirective', [])
264
264
.controller('Controller', ['$scope', function($scope) {
@@ -307,7 +307,7 @@ These restrictions can all be combined as needed:
307
307
308
308
Let's change our directive to use `restrict: 'E'`:
309
309
310
- <example module="docsRestrictDirective">
310
+ <example module="docsRestrictDirective" name="directive-restrict" >
311
311
<file name="script.js">
312
312
angular.module('docsRestrictDirective', [])
313
313
.controller('Controller', ['$scope', function($scope) {
@@ -363,7 +363,7 @@ given scope.
363
363
In its current implementation, we'd need to create a different controller each time in order to
364
364
re-use such a directive:
365
365
366
- <example module="docsScopeProblemExample">
366
+ <example module="docsScopeProblemExample" name="directive-scope-problem" >
367
367
<file name="script.js">
368
368
angular.module('docsScopeProblemExample', [])
369
369
.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
405
405
outside, and then map the outer scope to a directive's inner scope. We can do this by creating what
406
406
we call an **isolate scope**. To do this, we can use a {@link $compile#-scope- directive's `scope`} option:
407
407
408
- <example module="docsIsolateScopeDirective">
408
+ <example module="docsIsolateScopeDirective" name="directive-isolate" >
409
409
<file name="script.js">
410
410
angular.module('docsIsolateScopeDirective', [])
411
411
.controller('Controller', ['$scope', function($scope) {
@@ -478,7 +478,7 @@ scope has another effect.
478
478
We can show this by adding another property, `vojta`, to our scope and trying to access it from
479
479
within our directive's template:
480
480
481
- <example module="docsIsolationExample">
481
+ <example module="docsIsolationExample" name="directive-isolate-2" >
482
482
<file name="script.js">
483
483
angular.module('docsIsolationExample', [])
484
484
.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
557
557
end-to-end testing, where we want to ensure that all `$timeout`s have completed before completing the test.
558
558
We also want to remove the `$interval` if the directive is deleted so we don't introduce a memory leak.
559
559
560
- <example module="docsTimeDirective">
560
+ <example module="docsTimeDirective" name="directive-link" >
561
561
<file name="script.js">
562
562
angular.module('docsTimeDirective', [])
563
563
.controller('Controller', ['$scope', function($scope) {
@@ -633,7 +633,7 @@ wrap any arbitrary content.
633
633
634
634
To do this, we need to use the `transclude` option.
635
635
636
- <example module="docsTransclusionDirective">
636
+ <example module="docsTransclusionDirective" name="directive-transclude" >
637
637
<file name="script.js">
638
638
angular.module('docsTransclusionDirective', [])
639
639
.controller('Controller', ['$scope', function($scope) {
@@ -664,7 +664,7 @@ this option have access to the scope **outside** of the directive rather than in
664
664
To illustrate this, see the example below. Notice that we've added a `link` function in `script.js`
665
665
that redefines `name` as `Jeff`. What do you think the `{{name}}` binding will resolve to now?
666
666
667
- <example module="docsTransclusionExample">
667
+ <example module="docsTransclusionExample" name="directive-transclusion" >
668
668
<file name="script.js">
669
669
angular.module('docsTransclusionExample', [])
670
670
.controller('Controller', ['$scope', function($scope) {
@@ -714,7 +714,7 @@ arbitrary content.
714
714
Next, we want to add buttons to this dialog box, and allow someone using the directive to bind their
715
715
own behavior to it.
716
716
717
- <example module="docsIsoFnBindExample">
717
+ <example module="docsIsoFnBindExample" name="directive-transclusion-scope" >
718
718
<file name="script.js">
719
719
angular.module('docsIsoFnBindExample', [])
720
720
.controller('Controller', ['$scope', '$timeout', function($scope, $timeout) {
@@ -791,7 +791,7 @@ its elements.
791
791
For instance, what if we wanted to create a directive that lets a user drag an
792
792
element?
793
793
794
- <example module="dragModule">
794
+ <example module="dragModule" name="directive-drag" >
795
795
<file name="script.js">
796
796
angular.module('dragModule', [])
797
797
.directive('myDraggable', ['$document', function($document) {
@@ -848,7 +848,7 @@ Sometimes, you want a component that's built from a combination of directives.
848
848
Imagine you want to have a container with tabs in which the contents of the container correspond
849
849
to which tab is active.
850
850
851
- <example module="docsTabsExample">
851
+ <example module="docsTabsExample" name="directive-tabs" >
852
852
<file name="script.js">
853
853
angular.module('docsTabsExample', [])
854
854
.directive('myTabs', function() {
0 commit comments