Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit b11438f

Browse files
committed
docs(ts-to-js): add separate template files for some components
1 parent 33b6197 commit b11438f

18 files changed

+148
-96
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<button (click)="onOkClick()">
2+
{{okMsg}}
3+
</button>
4+
<button (click)="onNotOkClick()">
5+
{{notOkMsg}}
6+
</button>

public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-di-inject-additional.component.es6

+4-5
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ import {
88
import { BrowserModule } from '@angular/platform-browser';
99

1010
// #docregion
11+
// #docregion metadata
1112
@Component({
13+
moduleId: module.id,
1214
selector: 'hero-title',
13-
template: `
14-
<h1>{{titlePrefix}} {{title}}</h1>
15-
<button (click)="ok()">OK</button>
16-
<p>{{ msg }}</p>
17-
`
15+
templateUrl: 'title.component.html'
1816
})
17+
// #enddocregion metadata
1918
class TitleComponent {
2019
msg = '';
2120
constructor(

public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-io.component.es6

+2-8
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,9 @@ import { BrowserModule } from '@angular/platform-browser';
99

1010
// #docregion
1111
@Component({
12+
moduleId: module.id,
1213
selector: 'my-confirm',
13-
template: `
14-
<button (click)="onOkClick()">
15-
{{okMsg}}
16-
</button>
17-
<button (click)="onNotOkClick()">
18-
{{notOkMsg}}
19-
</button>
20-
`
14+
templateUrl: 'confirm.component.html'
2115
})
2216
class ConfirmComponent {
2317
@Input() okMsg;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1>{{titlePrefix}} {{title}}</h1>
2+
<button (click)="ok()">OK</button>
3+
<p>{{ msg }}</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<button (click)="onOkClick()">
2+
{{okMsg}}
3+
</button>
4+
<button (click)="onNotOkClick()">
5+
{{notOkMsg}}
6+
</button>

public/docs/_examples/cb-ts-to-js/js-es6/app/hero-di-inject-additional.component.es6

+4-5
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ class TitleComponent {
2020
}
2121
}
2222

23+
// #docregion metadata
2324
TitleComponent.annotations = [
2425
new Component({
26+
moduleId: module.id,
2527
selector: 'hero-title',
26-
template: `
27-
<h1>{{titlePrefix}} {{title}}</h1>
28-
<button (click)="ok()">OK</button>
29-
<p>{{ msg }}</p>
30-
`
28+
templateUrl: 'title.component.html'
3129
})
3230
];
31+
// #enddocregion metadata
3332

3433
TitleComponent.parameters = [
3534
[new Optional(), new Inject('titlePrefix')],

public/docs/_examples/cb-ts-to-js/js-es6/app/hero-io.component.es6

+2-8
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,9 @@ class ConfirmComponent {
2323

2424
ConfirmComponent.annotations = [
2525
new Component({
26+
moduleId: module.id,
2627
selector: 'my-confirm',
27-
template: `
28-
<button (click)="onOkClick()">
29-
{{okMsg}}
30-
</button>
31-
<button (click)="onNotOkClick()">
32-
{{notOkMsg}}
33-
</button>
34-
`,
28+
templateUrl: 'confirm.component.html',
3529
inputs: [
3630
'okMsg',
3731
'notOkMsg: cancelMsg'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1>{{titlePrefix}} {{title}}</h1>
2+
<button (click)="ok()">OK</button>
3+
<p>{{ msg }}</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<button (click)="onOkClick()">
2+
{{okMsg}}
3+
</button>
4+
<button (click)="onNotOkClick()">
5+
{{notOkMsg}}
6+
</button>

public/docs/_examples/cb-ts-to-js/js/app/hero-di-inject-additional.component.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
(function(app) {
22

33
// #docregion
4+
// #docregion metadata
45
var TitleComponent = ng.core.Component({
56
selector: 'hero-title',
6-
template:
7-
'<h1>{{titlePrefix}} {{title}}</h1>' +
8-
'<button (click)="ok()">OK</button>' +
9-
'<p>{{ msg }}</p>'
10-
}).Class({
7+
templateUrl: 'app/title.component.html'
8+
})
9+
// #enddocregion metadata
10+
.Class({
1111
constructor: [
1212
[ new ng.core.Optional(), new ng.core.Inject('titlePrefix') ],
1313
new ng.core.Attribute('title'),

public/docs/_examples/cb-ts-to-js/js/app/hero-io.component.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,15 @@
22
// #docregion
33
var ConfirmComponent = ng.core.Component({
44
selector: 'my-confirm',
5+
templateUrl: 'app/confirm.component.html',
56
inputs: [
67
'okMsg',
78
'notOkMsg: cancelMsg'
89
],
910
outputs: [
1011
'ok',
1112
'notOk: cancel'
12-
],
13-
template:
14-
'<button (click)="onOkClick()">' +
15-
'{{okMsg}}' +
16-
'</button>' +
17-
'<button (click)="onNotOkClick()">' +
18-
'{{notOkMsg}}' +
19-
'</button>'
13+
]
2014
}).Class({
2115
constructor: function() {
2216
this.ok = new ng.core.EventEmitter();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1>{{titlePrefix}} {{title}}</h1>
2+
<button (click)="ok()">OK</button>
3+
<p>{{ msg }}</p>

public/docs/_examples/cb-ts-to-js/js/index.html

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
<script src="node_modules/@angular/compiler/bundles/compiler.umd.js"></script>
1717
<script src="node_modules/@angular/platform-browser/bundles/platform-browser.umd.js"></script>
1818
<script src="node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js"></script>
19-
<script src="node_modules/@angular/router-deprecated/bundles/router-deprecated.umd.js"></script>
2019

2120
<script src="app/data.service.js"></script>
2221
<script src="app/hero.component.js"></script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<button (click)="onOkClick()">
2+
{{okMsg}}
3+
</button>
4+
<button (click)="onNotOkClick()">
5+
{{notOkMsg}}
6+
</button>

public/docs/_examples/cb-ts-to-js/ts/app/hero-di-inject-additional.component.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ import {
88
import { BrowserModule } from '@angular/platform-browser';
99

1010
// #docregion
11+
// #docregion metadata
1112
@Component({
13+
moduleId: module.id,
1214
selector: 'hero-title',
13-
template: `
14-
<h1>{{titlePrefix}} {{title}}</h1>
15-
<button (click)="ok()">OK</button>
16-
<p>{{ msg }}</p>
17-
`
15+
templateUrl: 'title.component.html'
1816
})
17+
// #enddocregion metadata
1918
class TitleComponent {
2019
private msg: string = '';
2120
constructor(

public/docs/_examples/cb-ts-to-js/ts/app/hero-io.component.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,9 @@ import { BrowserModule } from '@angular/platform-browser';
99

1010
// #docregion
1111
@Component({
12+
moduleId: module.id,
1213
selector: 'my-confirm',
13-
template: `
14-
<button (click)="onOkClick()">
15-
{{okMsg}}
16-
</button>
17-
<button (click)="onNotOkClick()">
18-
{{notOkMsg}}
19-
</button>
20-
`
14+
templateUrl: 'confirm.component.html'
2115
})
2216
class ConfirmComponent {
2317
@Input() okMsg: string;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<!-- #docregion -->
2+
<h1>{{titlePrefix}} {{title}}</h1>
3+
<button (click)="ok()">OK</button>
4+
<p>{{ msg }}</p>

0 commit comments

Comments
 (0)