5
5
* app this directive is contained in.
6
6
*
7
7
* Usage:
8
- * <live-example [name="..."] [plnkr='...'] [noSource] [embedded] [srcText="..."]>text</live-example>
8
+ * <live-example
9
+ * [name="..."]
10
+ * [plnkr='...']
11
+ * [noSource]
12
+ * [embedded]
13
+ * [embedded-style]
14
+ * [srcText="..."]
15
+ * [title="..."]>text</live-example>
9
16
* Example:
10
17
* <p>Run <live-example>Try the live example</live-example></p>.
11
18
* // ~/resources/live-examples/{chapter}/ts/plnkr.html
12
19
*
13
20
* <p>Run <live-example name="toh-1">this example</live-example></p>.
14
- * // ~/resources/live-examples/toh-1/ts/minimal.plnkr.html
21
+ * // ~/resources/live-examples/toh-1/ts/plnkr.html
22
+ *
23
+ * <p>Run <live-example name="toh-1" title="Tour of Heroes - Part 1"></live-example></p>.
24
+ * // ~/resources/live-examples/toh-1/ts/plnkr.html
15
25
*
16
26
* <p>Run <live-example plnkr="minimal"></live-example></p>.
17
27
* // ~/resources/live-examples/{chapter}/ts/minimal.plnkr.html
18
28
*
19
29
* <live-example embedded></live-example>
20
30
* // ~/resources/live-examples/{chapter}/ts/eplnkr.html
21
31
*
22
- * <live-example embedded plnkr="minimal"></live-example>
23
- * // ~/resources/live-examples/{chapter}/ts/minimal.eplnkr.html
32
+ * // Links to a *new* tab as an embedded style plunker editor
33
+ * <live-example embedded-style>this example</live-example>
34
+ * // ~/resources/live-examples/{chapter}//ts/eplnkr.html
35
+ *
36
+ * // Displays in *same* tab as an embedded style plunker editor
37
+ * <live-example name="toh-1" embedded plnkr="minimal" img="toh>Tour of Heroes - Part 1</live-example>
38
+ * // ~/resources/live-examples/toh-1/ts/minimal.eplnkr.html
24
39
*/
25
40
angularIO . directive ( 'liveExample' , [ '$location' , function ( $location ) {
26
41
@@ -46,7 +61,9 @@ angularIO.directive('liveExample', ['$location', function ($location) {
46
61
var text = tElement . text ( ) || 'live example' ;
47
62
var ex = attrs . name || NgIoUtil . getExampleName ( $location ) ;
48
63
var embedded = attrs . hasOwnProperty ( 'embedded' ) ;
49
- var plnkr = embedded ? 'eplnkr' : 'plnkr' ;
64
+ var embeddedStyle = embedded || attrs . hasOwnProperty ( 'embeddedstyle' ) || attrs . hasOwnProperty ( 'embeddedStyle' ) ;
65
+ var plnkr = embeddedStyle ? 'eplnkr' : 'plnkr' ;
66
+ var title = attrs [ 'title' ] ;
50
67
var href , template ;
51
68
var imageBase = '/resources/images/' ;
52
69
var defaultImg = 'plunker/placeholder.png' ;
@@ -69,7 +86,9 @@ angularIO.directive('liveExample', ['$location', function ($location) {
69
86
: '/resources/live-examples/' + ex + '/' + exLang + '/' + plnkr + '.html'
70
87
71
88
// Link to live example.
72
- var template = a ( text , { href : href , target : '_blank' } ) ;
89
+ var options = { href : href , target : '_blank' } ;
90
+ if ( title ) { options [ 'title' ] = title ; }
91
+ var template = a ( text , options ) ;
73
92
74
93
// The hosted example and sources are in different locations for Dart.
75
94
// Also show link to sources for Dart, unless noSource is specified.
0 commit comments