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

Commit aec9103

Browse files
committed
fix js examples
1 parent 549bf8e commit aec9103

File tree

79 files changed

+551
-560
lines changed

Some content is hidden

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

79 files changed

+551
-560
lines changed

public/docs/_examples/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
# example files
1212
_test-output
13+
protractor-helpers.js
14+
*/e2e-spec.js
1315
**/ts/**/*.js
1416
**/js-es6*/**/*.js
1517
**/ts-snippets/**/*.js

public/docs/_examples/_boilerplate/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"start:webpack": "webpack-dev-server --inline --progress --port 8080",
2828
"test:webpack": "karma start karma.webpack.conf.js",
2929
"build:webpack": "rimraf dist && webpack --config config/webpack.prod.js --bail",
30-
"build:babel": "babel app -d app --extensions \".es6\" --source-maps",
30+
"build:babel": "babel src -d src --extensions \".es6\" --source-maps",
3131
"copy-dist-files": "node ./copy-dist-files.js",
3232
"i18n": "ng-xi18n"
3333
},
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"build": "build:babel",
3-
"run": "http-server:e2e"
4-
}
2+
"build": "build:babel"
3+
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { Component } from '@angular/core';
2-
3-
@Component({
4-
moduleId: module.id,
5-
selector: 'my-app',
6-
templateUrl: './app.component.html',
7-
styles: [
8-
// See hero-di-inject-additional.component
9-
'hero-host, hero-host-meta { border: 1px dashed black; display: block; padding: 4px;}',
10-
'.heading {font-style: italic}'
11-
]
12-
})
13-
export class AppComponent {
14-
title = 'ES6 JavaScript with Decorators';
15-
}
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
moduleId: module.id,
5+
selector: 'my-app',
6+
templateUrl: './app.component.html',
7+
styles: [
8+
// See hero-di-inject-additional.component
9+
'hero-host, hero-host-meta { border: 1px dashed black; display: block; padding: 4px;}',
10+
'.heading {font-style: italic}'
11+
]
12+
})
13+
export class AppComponent {
14+
title = 'ES6 JavaScript with Decorators';
15+
}
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
<a id="toc"></a>
2-
<h1>{{title}}</h1>
3-
<a href="#class-metadata">Classes and Class Metadata</a><br>
4-
<a href="#io-metadata">Input and Output Decorators</a><br>
5-
<a href="#dependency-injection">Dependency Injection</a><br>
6-
<a href="#host-metadata">Host Metadata</a><br>
7-
<a href="#view-child-metadata">View and Child Metadata</a><br>
8-
9-
<hr>
10-
<h4 id="class-metadata">Classes and Class Metadata</h4>
11-
<hero-view></hero-view>
12-
<hero-lifecycle></hero-lifecycle>
13-
14-
<hr>
15-
<h4 id="io-metadata">Input and Output Metadata</h4>
16-
<hero-io></hero-io>
17-
18-
<hr>
19-
<h4 id="dependency-injection">Dependency Injection</h4>
20-
<hero-di></hero-di>
21-
<hero-di-inject></hero-di-inject>
22-
<hero-di-inject-additional></hero-di-inject-additional>
23-
24-
<hr>
25-
<h4 id="host-metadata">Host Metadata</h4>
26-
<hero-host></hero-host>
27-
<hero-host-meta></hero-host-meta>
28-
29-
<hr>
30-
<h4 id="view-child-metadata">View and Child Metadata</h4>
31-
<hero-queries></hero-queries>
1+
<a id="toc"></a>
2+
<h1>{{title}}</h1>
3+
<a href="#class-metadata">Classes and Class Metadata</a><br>
4+
<a href="#io-metadata">Input and Output Decorators</a><br>
5+
<a href="#dependency-injection">Dependency Injection</a><br>
6+
<a href="#host-metadata">Host Metadata</a><br>
7+
<a href="#view-child-metadata">View and Child Metadata</a><br>
8+
9+
<hr>
10+
<h4 id="class-metadata">Classes and Class Metadata</h4>
11+
<hero-view></hero-view>
12+
<hero-lifecycle></hero-lifecycle>
13+
14+
<hr>
15+
<h4 id="io-metadata">Input and Output Metadata</h4>
16+
<hero-io></hero-io>
17+
18+
<hr>
19+
<h4 id="dependency-injection">Dependency Injection</h4>
20+
<hero-di></hero-di>
21+
<hero-di-inject></hero-di-inject>
22+
<hero-di-inject-additional></hero-di-inject-additional>
23+
24+
<hr>
25+
<h4 id="host-metadata">Host Metadata</h4>
26+
<hero-host></hero-host>
27+
<hero-host-meta></hero-host-meta>
28+
29+
<hr>
30+
<h4 id="view-child-metadata">View and Child Metadata</h4>
31+
<hero-queries></hero-queries>
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
2-
import { BrowserModule } from '@angular/platform-browser';
3-
4-
import { AppComponent } from './app.component';
5-
import { ConfirmComponent } from './confirm.component';
6-
// #docregion appimport
7-
import { HeroComponent } from './hero.component';
8-
// #enddocregion appimport
9-
import { HeroComponent as HeroDIComponent } from './hero-di.component';
10-
import { HeroComponent as HeroDIInjectComponent } from './hero-di-inject.component';
11-
import { HeroComponent as HeroDIInjectAdditionalComponent } from './hero-di-inject-additional.component';
12-
import { HeroHostComponent } from './hero-host.component';
13-
import { HeroHostMetaComponent } from './hero-host-meta.component';
14-
import { HeroIOComponent } from './hero-io.component';
15-
import { HeroComponent as HeroLifecycleComponent } from './hero-lifecycle.component';
16-
import { HeroQueriesComponent, ViewChildComponent, ContentChildComponent } from './hero-queries.component';
17-
import { HeroTitleComponent } from './hero-title.component';
18-
19-
import { DataService } from './data.service';
20-
21-
@NgModule({
22-
imports: [
23-
BrowserModule
24-
],
25-
declarations: [
26-
AppComponent,
27-
ConfirmComponent,
28-
HeroComponent,
29-
HeroDIComponent,
30-
HeroDIInjectComponent,
31-
HeroDIInjectAdditionalComponent,
32-
HeroHostComponent, HeroHostMetaComponent,
33-
HeroIOComponent,
34-
HeroLifecycleComponent,
35-
HeroQueriesComponent, ViewChildComponent, ContentChildComponent,
36-
HeroTitleComponent
37-
],
38-
providers: [
39-
DataService,
40-
{ provide: 'heroName', useValue: 'Windstorm' }
41-
],
42-
bootstrap: [ AppComponent ],
43-
44-
// schemas: [ NO_ERRORS_SCHEMA ] // helpful for debugging
45-
})
46-
export class AppModule { }
47-
48-
/* tslint:disable no-unused-variable */
49-
// #docregion ng2import
50-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
51-
import {
52-
LocationStrategy,
53-
HashLocationStrategy
54-
} from '@angular/common';
55-
// #enddocregion ng2import
1+
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
2+
import { BrowserModule } from '@angular/platform-browser';
3+
4+
import { AppComponent } from './app.component';
5+
import { ConfirmComponent } from './confirm.component';
6+
// #docregion appimport
7+
import { HeroComponent } from './hero.component';
8+
// #enddocregion appimport
9+
import { HeroComponent as HeroDIComponent } from './hero-di.component';
10+
import { HeroComponent as HeroDIInjectComponent } from './hero-di-inject.component';
11+
import { HeroComponent as HeroDIInjectAdditionalComponent } from './hero-di-inject-additional.component';
12+
import { HeroHostComponent } from './hero-host.component';
13+
import { HeroHostMetaComponent } from './hero-host-meta.component';
14+
import { HeroIOComponent } from './hero-io.component';
15+
import { HeroComponent as HeroLifecycleComponent } from './hero-lifecycle.component';
16+
import { HeroQueriesComponent, ViewChildComponent, ContentChildComponent } from './hero-queries.component';
17+
import { HeroTitleComponent } from './hero-title.component';
18+
19+
import { DataService } from './data.service';
20+
21+
@NgModule({
22+
imports: [
23+
BrowserModule
24+
],
25+
declarations: [
26+
AppComponent,
27+
ConfirmComponent,
28+
HeroComponent,
29+
HeroDIComponent,
30+
HeroDIInjectComponent,
31+
HeroDIInjectAdditionalComponent,
32+
HeroHostComponent, HeroHostMetaComponent,
33+
HeroIOComponent,
34+
HeroLifecycleComponent,
35+
HeroQueriesComponent, ViewChildComponent, ContentChildComponent,
36+
HeroTitleComponent
37+
],
38+
providers: [
39+
DataService,
40+
{ provide: 'heroName', useValue: 'Windstorm' }
41+
],
42+
bootstrap: [ AppComponent ],
43+
44+
// schemas: [ NO_ERRORS_SCHEMA ] // helpful for debugging
45+
})
46+
export class AppModule { }
47+
48+
/* tslint:disable no-unused-variable */
49+
// #docregion ng2import
50+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
51+
import {
52+
LocationStrategy,
53+
HashLocationStrategy
54+
} from '@angular/common';
55+
// #enddocregion ng2import
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import { Component, EventEmitter, Input, Output } from '@angular/core';
2-
3-
// #docregion
4-
@Component({
5-
moduleId: module.id,
6-
selector: 'app-confirm',
7-
templateUrl: './confirm.component.html'
8-
})
9-
export class ConfirmComponent {
10-
@Input() okMsg = '';
11-
@Input('cancelMsg') notOkMsg = '';
12-
@Output() ok = new EventEmitter();
13-
@Output('cancel') notOk = new EventEmitter();
14-
15-
onOkClick() {
16-
this.ok.emit(true);
17-
}
18-
onNotOkClick() {
19-
this.notOk.emit(true);
20-
}
21-
}
22-
// #enddocregion
1+
import { Component, EventEmitter, Input, Output } from '@angular/core';
2+
3+
// #docregion
4+
@Component({
5+
moduleId: module.id,
6+
selector: 'app-confirm',
7+
templateUrl: './confirm.component.html'
8+
})
9+
export class ConfirmComponent {
10+
@Input() okMsg = '';
11+
@Input('cancelMsg') notOkMsg = '';
12+
@Output() ok = new EventEmitter();
13+
@Output('cancel') notOk = new EventEmitter();
14+
15+
onOkClick() {
16+
this.ok.emit(true);
17+
}
18+
onNotOkClick() {
19+
this.notOk.emit(true);
20+
}
21+
}
22+
// #enddocregion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<button (click)="onOkClick()">
2-
{{okMsg}}
3-
</button>
4-
<button (click)="onNotOkClick()">
5-
{{notOkMsg}}
6-
</button>
1+
<button (click)="onOkClick()">
2+
{{okMsg}}
3+
</button>
4+
<button (click)="onNotOkClick()">
5+
{{notOkMsg}}
6+
</button>
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
import { Component } from '@angular/core';
2-
3-
// #docregion
4-
@Component({
5-
selector: 'hero-host-meta',
6-
template: `
7-
<h1 [class.active]="active">Hero Host in Metadata</h1>
8-
<div>Heading clicks: {{clicks}}</div>
9-
`,
10-
host: {
11-
// HostBindings to the <hero-host-meta> element
12-
'[title]': 'title',
13-
'[class.heading]': 'headingClass',
14-
15-
// HostListeners on the entire <hero-host-meta> element
16-
'(click)': 'clicked()',
17-
'(mouseenter)': 'enter($event)',
18-
'(mouseleave)': 'leave($event)'
19-
},
20-
// Styles within (but excluding) the <hero-host-meta> element
21-
styles: ['.active {background-color: coral;}']
22-
})
23-
export class HeroHostMetaComponent {
24-
title = 'Hero Host in Metadata Tooltip';
25-
headingClass = true;
26-
27-
active = false;
28-
clicks = 0;
29-
30-
clicked() {
31-
this.clicks += 1;
32-
}
33-
34-
enter(event: Event) {
35-
this.active = true;
36-
this.headingClass = false;
37-
}
38-
39-
leave(event: Event) {
40-
this.active = false;
41-
this.headingClass = true;
42-
}
43-
}
44-
// #enddocregion
1+
import { Component } from '@angular/core';
2+
3+
// #docregion
4+
@Component({
5+
selector: 'hero-host-meta',
6+
template: `
7+
<h1 [class.active]="active">Hero Host in Metadata</h1>
8+
<div>Heading clicks: {{clicks}}</div>
9+
`,
10+
host: {
11+
// HostBindings to the <hero-host-meta> element
12+
'[title]': 'title',
13+
'[class.heading]': 'headingClass',
14+
15+
// HostListeners on the entire <hero-host-meta> element
16+
'(click)': 'clicked()',
17+
'(mouseenter)': 'enter($event)',
18+
'(mouseleave)': 'leave($event)'
19+
},
20+
// Styles within (but excluding) the <hero-host-meta> element
21+
styles: ['.active {background-color: coral;}']
22+
})
23+
export class HeroHostMetaComponent {
24+
title = 'Hero Host in Metadata Tooltip';
25+
headingClass = true;
26+
27+
active = false;
28+
clicks = 0;
29+
30+
clicked() {
31+
this.clicks += 1;
32+
}
33+
34+
enter(event: Event) {
35+
this.active = true;
36+
this.headingClass = false;
37+
}
38+
39+
leave(event: Event) {
40+
this.active = false;
41+
this.headingClass = true;
42+
}
43+
}
44+
// #enddocregion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- #docregion -->
2-
<h1>{{titlePrefix}} {{title}}</h1>
3-
<button (click)="ok()">OK</button>
4-
<p>{{ msg }}</p>
1+
<!-- #docregion -->
2+
<h1>{{titlePrefix}} {{title}}</h1>
3+
<button (click)="ok()">OK</button>
4+
<p>{{ msg }}</p>

public/docs/_examples/cb-ts-to-js/js-es6-decorators/index.html renamed to public/docs/_examples/cb-ts-to-js/js-es6-decorators/src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<script src="systemjs.config.js"></script>
1717
<script>
18-
System.import('app').catch(function(err){ console.error(err); });
18+
System.import('main.js').catch(function(err){ console.error(err); });
1919
</script>
2020
</head>
2121

0 commit comments

Comments
 (0)