diff --git a/.gitignore b/.gitignore
index 2666d27c27..df612cd56e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,7 @@ public/docs/xref-*.*
_zip-output
www*
npm-debug*.log*
+**/debug.log
*.plnkr.html
plnkr.html
*.eplnkr.html
diff --git a/.travis.yml b/.travis.yml
index 394e81297a..2e3b260e29 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,7 +10,7 @@ env:
- DBUS_SESSION_BUS_ADDRESS=/dev/null
- DISPLAY=:99.0
- CHROME_BIN=chromium-browser
- - LATEST_RELEASE=2.1.1
+ - LATEST_RELEASE=2.2.0
- TASK_FLAGS="--dgeni-log=warn"
matrix:
- TASK=lint
diff --git a/gulpfile.js b/gulpfile.js
index 5412201fdb..5a69023cfd 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -247,15 +247,16 @@ function findAndRunE2eTests(filter, outputFile) {
e2eSpecPaths.forEach(function(specPath) {
// get all of the examples under each dir where a pcFilename is found
localExamplePaths = getExamplePaths(specPath, true);
- // Filter by language
- localExamplePaths = localExamplePaths.filter(function (fn) {
- return fn.match('/'+lang+'$') != null;
- });
+ // Filter by example name
if (filter) {
localExamplePaths = localExamplePaths.filter(function (fn) {
return fn.match(filter) != null;
})
}
+ // Filter by language, also supports variations like js-es6
+ localExamplePaths = localExamplePaths.filter(function (fn) {
+ return fn.match('/'+lang+'(?:-[^/]*)?$') != null;
+ });
localExamplePaths.forEach(function(examplePath) {
examplePaths.push(examplePath);
})
@@ -754,7 +755,7 @@ gulp.task('check-deploy', ['firebase-use-proj-check', 'build-docs'], () => {
}).then(function(shouldDeploy) {
if (shouldDeploy) {
gutil.log('deploying...');
- return execPromise(`firebase deploy -p ${WWW}`);
+ return execPromise('firebase deploy');
} else {
return ['Not deploying'];
}
@@ -792,7 +793,9 @@ gulp.task('link-checker', function(done) {
'resources/%7B%7Bresource.url%7D%7D',
// API docs have links directly into GitHub repo sources; these can
// quickly become invalid, so ignore them for now:
- '*/angular/tree/*'
+ '*/angular/tree/*',
+ // harp.json "bios" for "Ryan Schmukler", URL isn't valid:
+ 'http://slingingcode.com'
];
var blcOptions = { requestMethod: method, excludedKeywords: exclude};
return linkChecker({ blcOptions: blcOptions });
@@ -1274,7 +1277,7 @@ function apiExamplesWatch(postShredAction) {
}
function devGuideExamplesWatch(shredOptions, postShredAction, focus) {
- var watchPattern = focus ? '**/{' + focus + ',cb-' + focus+ '}/**/*.*' : '**/*.*';
+ var watchPattern = focus ? '{' + focus + ',cb-' + focus+ '}/**/*.*' : '**/*.*';
var includePattern = path.join(shredOptions.examplesDir, watchPattern);
// removed this version because gulp.watch has the same glob issue that dgeni has.
// var excludePattern = '!' + path.join(shredOptions.examplesDir, '**/node_modules/**/*.*');
diff --git a/harp.json b/harp.json
index 648e23e405..efdf6a8905 100644
--- a/harp.json
+++ b/harp.json
@@ -31,7 +31,7 @@
"picture": "/resources/images/bios/naomi.jpg",
"twitter": "naomitraveller",
"website": "http://google.com/+NaomiBlack",
- "bio": "Naomi is Angular's TPM generalist and jack-of-all-trades. She leads Angular Material and AngularDart, and acts as webmaster for angular.io. She's been at Google since 2006, as a technical program manager on projects ranging from Accessibility to Google Transit. She fights daleks in her spare time.",
+ "bio": "Naomi is Angular's TPM generalist and jack-of-all-trades. She leads Angular's global programs (including localization), supports Angular's internal Google users, and acts as webmaster for angular.io and angular.cn. She's been at Google since 2006, as a technical program manager on projects ranging from Accessibility to Google Transit. She fights daleks in her spare time.",
"type": "Lead"
},
@@ -40,7 +40,7 @@
"picture": "/resources/images/bios/brad-green.jpg",
"twitter": "bradlygreen",
"website": "https://plus.google.com/+BradGreen",
- "bio": "Brad Green works at Google as an engineering director. Brad manages the Google Sales Platform suite of projects as well as the AngularJS framework. Prior to Google, Brad worked on the early mobile web at AvantGo, founded and sold startups, and spent a few hard years toiling as a caterer. Brad's first job out of school was as lackey to Steve Jobs at NeXT Computer writing demo software and designing his slide presentations. Brad lives in Mountain View, CA with his wife and two children.",
+ "bio": "Brad Green works at Google as an engineering director. Brad manages the Google Sales Platform suite of projects as well as the AngularJS framework. Prior to Google, Brad worked on the early mobile web at AvantGo, founded and sold startups, and spent a few hard years toiling as a caterer. Brad's first job out of school was as lackey to Steve Jobs at NeXT Computer writing demo software and designing his slide presentations. Brad enjoys throwing dinner parties with his wife Heather and putting on plays with his children.",
"type": "Lead"
},
@@ -49,7 +49,7 @@
"picture": "/resources/images/bios/juleskremer.jpg",
"twitter": "jules_kremer",
"website": "https://plus.google.com/+JulesKremer",
- "bio": "Jules is a TPM on the Angular team. When not working with developers, Jules is often bending into pretzel-like shapes, climbing mountains or drinking really awesome beer.",
+ "bio": "Jules is Head of Angular Developer Relations at Google. When not working with developers, Jules is often bending into pretzel-like shapes, climbing mountains or drinking really awesome beer.",
"type": "Lead"
},
diff --git a/public/_includes/_footer.jade b/public/_includes/_footer.jade
index 21113616e9..db6f393081 100644
--- a/public/_includes/_footer.jade
+++ b/public/_includes/_footer.jade
@@ -22,7 +22,7 @@ div(class="main-footer" data-swiftype-index="false")
//li Libraries
li About
li 关于
- li Books & Training
+ li Books & Training
li 书籍与培训
li Tools & Libraries
li 工具与库
@@ -68,7 +68,7 @@ div(class="main-footer" data-swiftype-index="false")
h3.text-headline 其它语种
ul.text-body
- li English
+ li 中文版
footer(class="background-midnight")
small.text-caption Powered by Google ©2010-2016. Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
@@ -77,6 +77,6 @@ div(class="main-footer" data-swiftype-index="false")
a(aria-label="查看风格指南" href="/docs/ts/latest/styleguide.html" title="风格指南" class="styleguide-trigger text-snow translated-cn" md-button)
span.icon-favorite
- p
+ p
small.text-caption 本网站由洛阳永欣维护
a(href="http://www.miitbeian.gov.cn/") 豫ICP备16019859号-1
diff --git a/public/_includes/_util-fns.jade b/public/_includes/_util-fns.jade
index 29639891e5..513d9af590 100644
--- a/public/_includes/_util-fns.jade
+++ b/public/_includes/_util-fns.jade
@@ -38,12 +38,16 @@
//- Location of sample code
- var _liveLink = 'live link';
+- var _ngRepoURL = 'https://github.com/angular/angular';
+- var _ngDocRepoURL = 'https://github.com/angular/angular.io';
+- var _qsRepo = 'https://github.com/angular/quickstart/blob/master/README.md'
//- NgModule related
- var _AppModuleVsAppComp = 'AppModule'
- var _appModuleTsVsAppCompTs = 'app/app.module.ts'
- var _appModuleTsVsMainTs = 'app/app.module.ts'
- var _bootstrapModule = 'bootstrapModule'
+- var _declsVsDirectives = 'declarations'
- var _moduleVsComp = 'module'
- var _moduleVsRootComp = 'module'
- var _platformBrowserDynamicVsBootStrap = 'platformBrowserDynamic'
diff --git a/public/_includes/_version-dropdown.jade b/public/_includes/_version-dropdown.jade
index d54f759625..e3a63188e1 100644
--- a/public/_includes/_version-dropdown.jade
+++ b/public/_includes/_version-dropdown.jade
@@ -61,16 +61,16 @@ if language == 'dart'
else
- var title = 'Angular ' + version + ' for Dart'
+if current.path[4] !== 'change-log'
+ //- DROPDOWN BUTTON
+ nav.dropdown
+ button(aria-label="选择Angular版本" md-button class="dropdown-button" ng-click="appCtrl.toggleVersionMenu($event)") #{title}
+ div(class="overlay ng-hide" ng-click="appCtrl.toggleVersionMenu($event)" ng-show="appCtrl.showMenu")
-
-nav.dropdown
- button(aria-label="选择Angular版本" md-button class="dropdown-button" ng-click="appCtrl.toggleVersionMenu($event)") #{title}
- div(class="overlay ng-hide" ng-click="appCtrl.toggleVersionMenu($event)" ng-show="appCtrl.showMenu")
-
-
- ul(class="dropdown-menu" ng-class="appCtrl.showMenu ? 'is-visible' : ''")
- mixin tree(public.docs.ts, "/docs/ts", "Angular for TypeScript")
- mixin tree(public.docs.js, "/docs/js", "Angular for JavaScript")
- //- Disable cross-language link for API entry pages (but keep for top API search page):
- if ! (current.path[3] === 'api' && public.docs[current.path[1]][current.path[2]][current.path[3]][current.path[4]])
- mixin tree(public.docs.dart, "/docs/dart", "Angular for Dart")
+ //- DROPDOWN MENU
+ ul(class="dropdown-menu" ng-class="appCtrl.showMenu ? 'is-visible' : ''")
+ mixin tree(public.docs.ts, "/docs/ts", "Angular for TypeScript")
+ mixin tree(public.docs.js, "/docs/js", "Angular for JavaScript")
+ //- Disable cross-language link for API entry pages (but keep for top API search page):
+ if ! (current.path[3] === 'api' && public.docs[current.path[1]][current.path[2]][current.path[3]][current.path[4]])
+ mixin tree(public.docs.dart, "/docs/dart", "Angular for Dart")
diff --git a/public/docs/_examples/.gitignore b/public/docs/_examples/.gitignore
index b6733dc6ea..3d007625ef 100644
--- a/public/docs/_examples/.gitignore
+++ b/public/docs/_examples/.gitignore
@@ -11,10 +11,12 @@ wallaby.js
_test-output
**/ts/**/*.js
+**/js-es6*/**/*.js
**/ts-snippets/**/*.js
*.d.ts
!**/*e2e-spec.js
!systemjs.config.1.js
+!**/systemjs.config.extras.js
!_boilerplate/*
_boilerplate/a2docs.css
diff --git a/public/docs/_examples/_boilerplate/package.json b/public/docs/_examples/_boilerplate/package.json
index 3f255fcbd6..bcccdd978a 100644
--- a/public/docs/_examples/_boilerplate/package.json
+++ b/public/docs/_examples/_boilerplate/package.json
@@ -18,6 +18,7 @@
"build:webpack": "rimraf dist && webpack --config config/webpack.prod.js --bail",
"build:cli": "ng build",
"build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup-config.js",
+ "build:babel": "babel app -d app --extensions \".es6\" --source-maps",
"copy-dist-files": "node ./copy-dist-files.js",
"i18n": "ng-xi18n"
},
diff --git a/public/docs/_examples/_boilerplate/plunker.README.md b/public/docs/_examples/_boilerplate/plunker.README.md
deleted file mode 100644
index fa2e46f47a..0000000000
--- a/public/docs/_examples/_boilerplate/plunker.README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-### Angular Documentation Example
-
diff --git a/public/docs/_examples/_boilerplate/systemjs.config.js b/public/docs/_examples/_boilerplate/systemjs.config.js
index 457f040fc0..0d748b9e5e 100644
--- a/public/docs/_examples/_boilerplate/systemjs.config.js
+++ b/public/docs/_examples/_boilerplate/systemjs.config.js
@@ -21,8 +21,10 @@
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
+ '@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
+ '@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
diff --git a/public/docs/_examples/_boilerplate/systemjs.config.web.build.js b/public/docs/_examples/_boilerplate/systemjs.config.web.build.js
index 3fa201a280..b340fc6159 100644
--- a/public/docs/_examples/_boilerplate/systemjs.config.web.build.js
+++ b/public/docs/_examples/_boilerplate/systemjs.config.web.build.js
@@ -11,19 +11,15 @@
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
transpiler: 'ts',
typescriptOptions: {
- // Complete copy of compiler options in standard tsconfig.json
+ // Copy of compiler options in standard tsconfig.json
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
- "removeComments": false,
"noImplicitAny": true,
- "suppressImplicitAnyIndexErrors": true,
- "typeRoots": [
- "../../node_modules/@types/"
- ]
+ "suppressImplicitAnyIndexErrors": true
},
meta: {
'typescript': {
@@ -48,8 +44,10 @@
'@angular/platform-browser-dynamic': 'ng:platform-browser-dynamic-builds/master/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'ng:http-builds/master/bundles/http.umd.js',
'@angular/router': 'ng:router-builds/master/bundles/router.umd.js',
+ '@angular/router/upgrade': 'ng:router-builds/master/bundles/router-upgrade.umd.js',
'@angular/forms': 'ng:forms-builds/master/bundles/forms.umd.js',
'@angular/upgrade': 'ng:upgrade-builds/master/bundles/upgrade.umd.js',
+ '@angular/upgrade/static': 'ng:upgrade-builds/master/bundles/upgrade-static.umd.js',
// angular testing umd bundles (overwrite the shim mappings)
'@angular/core/testing': 'ng:core-builds/master/bundles/core-testing.umd.js',
@@ -80,10 +78,13 @@
}
});
- if (!global.noBootstrap) { bootstrap(); }
+ if (global.autoBootstrap) { bootstrap(); }
- // Bootstrap the `AppModule`(skip the `app/main.ts` that normally does this)
+ // Bootstrap with a default `AppModule`
+ // ignore an `app/app.module.ts` and `app/main.ts`, even if present
+ // This function exists primarily (exclusively?) for the QuickStart
function bootstrap() {
+ console.log('Auto-bootstrapping');
// Stub out `app/main.ts` so System.import('app') doesn't fail if called in the index.html
System.set(System.normalizeSync('app/main.ts'), System.newModule({ }));
@@ -91,7 +92,7 @@
// bootstrap and launch the app (equivalent to standard main.ts)
Promise.all([
System.import('@angular/platform-browser-dynamic'),
- System.import('app/app.module')
+ getAppModule()
])
.then(function (imports) {
var platform = imports[0];
@@ -101,4 +102,38 @@
.catch(function(err){ console.error(err); });
}
+ // Make the default AppModule
+ // returns a promise for the AppModule
+ function getAppModule() {
+ console.log('Making a bare-bones, default AppModule');
+
+ return Promise.all([
+ System.import('@angular/core'),
+ System.import('@angular/platform-browser'),
+ System.import('app/app.component')
+ ])
+ .then(function (imports) {
+
+ var core = imports[0];
+ var browser = imports[1];
+ var appComp = imports[2].AppComponent;
+
+ var AppModule = function() {}
+
+ AppModule.annotations = [
+ new core.NgModule({
+ imports: [ browser.BrowserModule ],
+ declarations: [ appComp ],
+ bootstrap: [ appComp ]
+ })
+ ]
+ return {AppModule: AppModule};
+ })
+ }
})(this);
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
diff --git a/public/docs/_examples/_boilerplate/systemjs.config.web.js b/public/docs/_examples/_boilerplate/systemjs.config.web.js
index 40e6a67fc6..768d357ed7 100644
--- a/public/docs/_examples/_boilerplate/systemjs.config.web.js
+++ b/public/docs/_examples/_boilerplate/systemjs.config.web.js
@@ -9,19 +9,15 @@
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
transpiler: 'ts',
typescriptOptions: {
- // Complete copy of compiler options in standard tsconfig.json
+ // Copy of compiler options in standard tsconfig.json
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
- "removeComments": false,
"noImplicitAny": true,
- "suppressImplicitAnyIndexErrors": true,
- "typeRoots": [
- "../../node_modules/@types/"
- ]
+ "suppressImplicitAnyIndexErrors": true
},
meta: {
'typescript': {
@@ -45,8 +41,10 @@
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
+ '@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
+ '@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
@@ -67,10 +65,13 @@
}
});
- if (!global.noBootstrap) { bootstrap(); }
+ if (global.autoBootstrap) { bootstrap(); }
- // Bootstrap the `AppModule`(skip the `app/main.ts` that normally does this)
+ // Bootstrap with a default `AppModule`
+ // ignore an `app/app.module.ts` and `app/main.ts`, even if present
+ // This function exists primarily (exclusively?) for the QuickStart
function bootstrap() {
+ console.log('Auto-bootstrapping');
// Stub out `app/main.ts` so System.import('app') doesn't fail if called in the index.html
System.set(System.normalizeSync('app/main.ts'), System.newModule({ }));
@@ -78,7 +79,7 @@
// bootstrap and launch the app (equivalent to standard main.ts)
Promise.all([
System.import('@angular/platform-browser-dynamic'),
- System.import('app/app.module')
+ getAppModule()
])
.then(function (imports) {
var platform = imports[0];
@@ -88,4 +89,38 @@
.catch(function(err){ console.error(err); });
}
+ // Make the default AppModule
+ // returns a promise for the AppModule
+ function getAppModule() {
+ console.log('Making a bare-bones, default AppModule');
+
+ return Promise.all([
+ System.import('@angular/core'),
+ System.import('@angular/platform-browser'),
+ System.import('app/app.component')
+ ])
+ .then(function (imports) {
+
+ var core = imports[0];
+ var browser = imports[1];
+ var appComp = imports[2].AppComponent;
+
+ var AppModule = function() {}
+
+ AppModule.annotations = [
+ new core.NgModule({
+ imports: [ browser.BrowserModule ],
+ declarations: [ appComp ],
+ bootstrap: [ appComp ]
+ })
+ ]
+ return {AppModule: AppModule};
+ })
+ }
})(this);
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
diff --git a/public/docs/_examples/animations/ts/index.html b/public/docs/_examples/animations/ts/index.html
index 76a7b93356..8188d14709 100644
--- a/public/docs/_examples/animations/ts/index.html
+++ b/public/docs/_examples/animations/ts/index.html
@@ -9,7 +9,7 @@
-
+
diff --git a/public/docs/_examples/architecture/dart/lib/sales_tax_component.dart b/public/docs/_examples/architecture/dart/lib/sales_tax_component.dart
index 7f5ed5036c..4a1977ba06 100644
--- a/public/docs/_examples/architecture/dart/lib/sales_tax_component.dart
+++ b/public/docs/_examples/architecture/dart/lib/sales_tax_component.dart
@@ -11,10 +11,7 @@ import 'tax_rate_service.dart';
The sales tax is
- {{ getTax(amountBox.value) | currency:'USD':false:'1.2-2' }}
-
+ {{ getTax(amountBox.value) | currency:'USD':true:'1.2-2' }}
''',
providers: const [SalesTaxService, TaxRateService])
diff --git a/public/docs/_examples/architecture/dart/pubspec.yaml b/public/docs/_examples/architecture/dart/pubspec.yaml
index 4b7f63f5f0..007ec9f4e8 100644
--- a/public/docs/_examples/architecture/dart/pubspec.yaml
+++ b/public/docs/_examples/architecture/dart/pubspec.yaml
@@ -6,6 +6,7 @@ environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: ^2.0.0
+dev_dependencies:
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:
diff --git a/public/docs/_examples/architecture/e2e-spec.ts b/public/docs/_examples/architecture/e2e-spec.ts
index c1ee8cf00d..e967804483 100644
--- a/public/docs/_examples/architecture/e2e-spec.ts
+++ b/public/docs/_examples/architecture/e2e-spec.ts
@@ -71,9 +71,7 @@ function salesTaxTests() {
it('shows sales tax', async function () {
let page = getPageElts();
page.salesTaxAmountInput.sendKeys('10', protractor.Key.ENTER);
- // Note: due to Dart bug USD is shown instead of $
- let re = /The sales tax is (\$|USD)1.00/;
- expect(page.salesTaxDetail.getText()).toMatch(re);
+ expect(page.salesTaxDetail.getText()).toEqual('The sales tax is $1.00');
});
}
diff --git a/public/docs/_examples/architecture/ts/index.html b/public/docs/_examples/architecture/ts/index.html
index 090bd17c7b..d22ff7f6e4 100644
--- a/public/docs/_examples/architecture/ts/index.html
+++ b/public/docs/_examples/architecture/ts/index.html
@@ -6,7 +6,7 @@
-
+
diff --git a/public/docs/_examples/attribute-directives/dart/pubspec.yaml b/public/docs/_examples/attribute-directives/dart/pubspec.yaml
index d432cac246..4120561645 100644
--- a/public/docs/_examples/attribute-directives/dart/pubspec.yaml
+++ b/public/docs/_examples/attribute-directives/dart/pubspec.yaml
@@ -6,6 +6,7 @@ environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: ^2.0.0
+dev_dependencies:
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:
diff --git a/public/docs/_examples/attribute-directives/ts/index.html b/public/docs/_examples/attribute-directives/ts/index.html
index 197f1a8280..f3b37e823a 100644
--- a/public/docs/_examples/attribute-directives/ts/index.html
+++ b/public/docs/_examples/attribute-directives/ts/index.html
@@ -7,7 +7,7 @@
-
+
diff --git a/public/docs/_examples/cb-a1-a2-quick-reference/ts/index.html b/public/docs/_examples/cb-a1-a2-quick-reference/ts/index.html
index ee2eb6fdec..75e16b476c 100644
--- a/public/docs/_examples/cb-a1-a2-quick-reference/ts/index.html
+++ b/public/docs/_examples/cb-a1-a2-quick-reference/ts/index.html
@@ -9,7 +9,7 @@
-
+
diff --git a/public/docs/_examples/cb-component-communication/ts/index.html b/public/docs/_examples/cb-component-communication/ts/index.html
index 4afa076c19..d4c62ed916 100644
--- a/public/docs/_examples/cb-component-communication/ts/index.html
+++ b/public/docs/_examples/cb-component-communication/ts/index.html
@@ -9,7 +9,7 @@
-
+
diff --git a/public/docs/_examples/cb-component-relative-paths/ts/index.html b/public/docs/_examples/cb-component-relative-paths/ts/index.html
index cc0d972df2..3a5c532b82 100644
--- a/public/docs/_examples/cb-component-relative-paths/ts/index.html
+++ b/public/docs/_examples/cb-component-relative-paths/ts/index.html
@@ -13,7 +13,7 @@
-
+
diff --git a/public/docs/_examples/cb-dependency-injection/ts/index.html b/public/docs/_examples/cb-dependency-injection/ts/index.html
index ba1d2761e1..c978778d09 100644
--- a/public/docs/_examples/cb-dependency-injection/ts/index.html
+++ b/public/docs/_examples/cb-dependency-injection/ts/index.html
@@ -10,7 +10,7 @@
-
+
diff --git a/public/docs/_examples/cb-dynamic-form/ts/index.html b/public/docs/_examples/cb-dynamic-form/ts/index.html
index ec3e1cbbb2..23d56ae14f 100644
--- a/public/docs/_examples/cb-dynamic-form/ts/index.html
+++ b/public/docs/_examples/cb-dynamic-form/ts/index.html
@@ -10,7 +10,7 @@
-
+
diff --git a/public/docs/_examples/cb-form-validation/ts/index.html b/public/docs/_examples/cb-form-validation/ts/index.html
index 8fc614fe0f..54ad9c69ab 100644
--- a/public/docs/_examples/cb-form-validation/ts/index.html
+++ b/public/docs/_examples/cb-form-validation/ts/index.html
@@ -9,7 +9,7 @@
-
+
diff --git a/public/docs/_examples/cb-set-document-title/ts/index.html b/public/docs/_examples/cb-set-document-title/ts/index.html
index 8f1ad96812..0543070fbd 100644
--- a/public/docs/_examples/cb-set-document-title/ts/index.html
+++ b/public/docs/_examples/cb-set-document-title/ts/index.html
@@ -14,7 +14,7 @@
-
+
diff --git a/public/docs/_examples/cb-ts-to-js/e2e-spec.ts b/public/docs/_examples/cb-ts-to-js/e2e-spec.ts
index 5862beeebf..bc67bac8f0 100644
--- a/public/docs/_examples/cb-ts-to-js/e2e-spec.ts
+++ b/public/docs/_examples/cb-ts-to-js/e2e-spec.ts
@@ -1,4 +1,4 @@
-'use strict'; // necessary for es6 output in node
+'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
@@ -9,7 +9,7 @@ describe('TypeScript to Javascript tests', function () {
});
it('should display the basic component example', function () {
- testTag('hero-view', 'Hero: Windstorm');
+ testTag('hero-view', 'Hero Detail: Windstorm');
});
it('should display the component example with lifecycle methods', function () {
@@ -36,7 +36,7 @@ describe('TypeScript to Javascript tests', function () {
it('should support component with inputs and outputs', function () {
let app = element(by.css('hero-io'));
- let confirmComponent = app.element(by.css('my-confirm'));
+ let confirmComponent = app.element(by.css('app-confirm'));
confirmComponent.element(by.buttonText('OK')).click();
expect(app.element(by.cssContainingText('span', 'OK clicked')).isPresent()).toBe(true);
@@ -46,11 +46,11 @@ describe('TypeScript to Javascript tests', function () {
});
it('should support host bindings and host listeners', function() {
- let app = element(by.css('heroes-bindings'));
+ let app = element(by.css('hero-host'));
let h1 = app.element(by.css('h1'));
expect(app.getAttribute('class')).toBe('heading');
- expect(app.getAttribute('title')).toBe('Tooltip content');
+ expect(app.getAttribute('title')).toContain('Tooltip');
h1.click();
expect(h1.getAttribute('class')).toBe('active');
@@ -61,12 +61,12 @@ describe('TypeScript to Javascript tests', function () {
});
it('should support content and view queries', function() {
- let app = element(by.css('heroes-queries'));
- let windstorm = app.element(by.css('a-hero:first-child'));
+ let app = element(by.css('hero-queries'));
+ let windstorm = app.element(by.css('view-child:first-child'));
- app.element(by.buttonText('Activate')).click();
+ app.element(by.css('button')).click();
expect(windstorm.element(by.css('h2')).getAttribute('class')).toBe('active');
- expect(windstorm.element(by.css('active-label')).getText()).toBe('Active');
+ expect(windstorm.element(by.css('content-child')).getText()).toBe('Active');
});
function testTag(selector: string, expectedText: string) {
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/.babelrc b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/.babelrc
new file mode 100644
index 0000000000..3aaf507508
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/.babelrc
@@ -0,0 +1,6 @@
+{
+ "presets": [
+ "es2015",
+ "angular2"
+ ]
+}
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/app.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/app.component.es6
new file mode 100644
index 0000000000..e5f158dbed
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/app.component.es6
@@ -0,0 +1,15 @@
+import { Component } from '@angular/core';
+
+@Component({
+ moduleId: module.id,
+ selector: 'my-app',
+ templateUrl: 'app.component.html',
+ styles: [
+ // See hero-di-inject-additional.component
+ 'hero-host, hero-host-meta { border: 1px dashed black; display: block; padding: 4px;}',
+ '.heading {font-style: italic}'
+ ]
+})
+export class AppComponent {
+ title = 'ES6 JavaScript with Decorators';
+}
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/app.component.html b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/app.component.html
new file mode 100644
index 0000000000..7f1efd31a0
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/app.component.html
@@ -0,0 +1,31 @@
+
+{{title}}
+Classes and Class Metadata
+Input and Output Decorators
+Dependency Injection
+Host Metadata
+View and Child Metadata
+
+
+
+
+
+
+
+
+
+
+
+Dependency Injection
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/app.module.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/app.module.es6
new file mode 100644
index 0000000000..bea55777ef
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/app.module.es6
@@ -0,0 +1,55 @@
+import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
+import { BrowserModule } from '@angular/platform-browser';
+
+import { AppComponent } from './app.component';
+import { ConfirmComponent } from './confirm.component';
+// #docregion appimport
+import { HeroComponent } from './hero.component';
+// #enddocregion appimport
+import { HeroComponent as HeroDIComponent } from './hero-di.component';
+import { HeroComponent as HeroDIInjectComponent } from './hero-di-inject.component';
+import { HeroComponent as HeroDIInjectAdditionalComponent } from './hero-di-inject-additional.component';
+import { HeroHostComponent } from './hero-host.component';
+import { HeroHostMetaComponent } from './hero-host-meta.component';
+import { HeroIOComponent } from './hero-io.component';
+import { HeroComponent as HeroLifecycleComponent } from './hero-lifecycle.component';
+import { HeroQueriesComponent, ViewChildComponent, ContentChildComponent } from './hero-queries.component';
+import { HeroTitleComponent } from './hero-title.component';
+
+import { DataService } from './data.service';
+
+@NgModule({
+ imports: [
+ BrowserModule
+ ],
+ declarations: [
+ AppComponent,
+ ConfirmComponent,
+ HeroComponent,
+ HeroDIComponent,
+ HeroDIInjectComponent,
+ HeroDIInjectAdditionalComponent,
+ HeroHostComponent, HeroHostMetaComponent,
+ HeroIOComponent,
+ HeroLifecycleComponent,
+ HeroQueriesComponent, ViewChildComponent, ContentChildComponent,
+ HeroTitleComponent
+ ],
+ providers: [
+ DataService,
+ { provide: 'heroName', useValue: 'Windstorm' }
+ ],
+ bootstrap: [ AppComponent ],
+
+ // schemas: [ NO_ERRORS_SCHEMA ] // helpful for debugging
+})
+export class AppModule { }
+
+/* tslint:disable no-unused-variable */
+// #docregion ng2import
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+import {
+ LocationStrategy,
+ HashLocationStrategy
+} from '@angular/common';
+// #enddocregion ng2import
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/confirm.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/confirm.component.es6
new file mode 100644
index 0000000000..08a0ed6c60
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/confirm.component.es6
@@ -0,0 +1,22 @@
+import { Component, EventEmitter, Input, Output } from '@angular/core';
+
+// #docregion
+@Component({
+ moduleId: module.id,
+ selector: 'app-confirm',
+ templateUrl: 'confirm.component.html'
+})
+export class ConfirmComponent {
+ @Input() okMsg = '';
+ @Input('cancelMsg') notOkMsg = '';
+ @Output() ok = new EventEmitter();
+ @Output('cancel') notOk = new EventEmitter();
+
+ onOkClick() {
+ this.ok.emit(true);
+ }
+ onNotOkClick() {
+ this.notOk.emit(true);
+ }
+}
+// #enddocregion
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/confirm.component.html b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/confirm.component.html
new file mode 100644
index 0000000000..917bd1696f
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/confirm.component.html
@@ -0,0 +1,6 @@
+
+
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/data.service.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/data.service.es6
new file mode 100644
index 0000000000..cd7f9e1aae
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/data.service.es6
@@ -0,0 +1,10 @@
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class DataService {
+ constructor() { }
+
+ getHeroName() {
+ return 'Windstorm';
+ }
+}
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-di-inject-additional.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-di-inject-additional.component.es6
new file mode 100644
index 0000000000..ec460a9dbc
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-di-inject-additional.component.es6
@@ -0,0 +1,7 @@
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'hero-di-inject-additional',
+ template: ``
+})
+export class HeroComponent { }
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-di-inject.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-di-inject.component.es6
new file mode 100644
index 0000000000..94b42f956a
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-di-inject.component.es6
@@ -0,0 +1,13 @@
+import { Component, Inject } from '@angular/core';
+
+// #docregion
+@Component({
+ selector: 'hero-di-inject',
+ template: `Hero: {{name}}
`
+})
+export class HeroComponent {
+ constructor(@Inject('heroName') name) {
+ this.name = name;
+ }
+}
+// #enddocregion
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-di.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-di.component.es6
new file mode 100644
index 0000000000..0cc78d277e
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-di.component.es6
@@ -0,0 +1,15 @@
+import { Component } from '@angular/core';
+import { DataService } from './data.service';
+
+// #docregion
+@Component({
+ selector: 'hero-di',
+ template: `Hero: {{name}}
`
+})
+export class HeroComponent {
+ name = '';
+ constructor(dataService: DataService) {
+ this.name = dataService.getHeroName();
+ }
+}
+// #enddocregion
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-host-meta.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-host-meta.component.es6
new file mode 100644
index 0000000000..25dbe1c21a
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-host-meta.component.es6
@@ -0,0 +1,44 @@
+import { Component } from '@angular/core';
+
+// #docregion
+@Component({
+ selector: 'hero-host-meta',
+ template: `
+ Hero Host in Metadata
+ Heading clicks: {{clicks}}
+ `,
+ host: {
+ // HostBindings to the element
+ '[title]': 'title',
+ '[class.heading]': 'headingClass',
+
+ // HostListeners on the entire element
+ '(click)': 'clicked()',
+ '(mouseenter)': 'enter($event)',
+ '(mouseleave)': 'leave($event)'
+ },
+ // Styles within (but excluding) the element
+ styles: ['.active {background-color: coral;}']
+})
+export class HeroHostMetaComponent {
+ title = 'Hero Host in Metadata Tooltip';
+ headingClass = true;
+
+ active = false;
+ clicks = 0;
+
+ clicked() {
+ this.clicks += 1;
+ }
+
+ enter(event: Event) {
+ this.active = true;
+ this.headingClass = false;
+ }
+
+ leave(event: Event) {
+ this.active = false;
+ this.headingClass = true;
+ }
+}
+// #enddocregion
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-host.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-host.component.es6
new file mode 100644
index 0000000000..e8d72233c8
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-host.component.es6
@@ -0,0 +1,39 @@
+import { Component, HostBinding, HostListener } from '@angular/core';
+
+// #docregion
+@Component({
+ selector: 'hero-host',
+ template: `
+ Hero Host in Decorators
+ Heading clicks: {{clicks}}
+ `,
+ // Styles within (but excluding) the element
+ styles: ['.active {background-color: yellow;}']
+})
+export class HeroHostComponent {
+ // HostBindings to the element
+ @HostBinding() title = 'Hero Host in Decorators Tooltip';
+ @HostBinding('class.heading') headingClass = true;
+
+ active = false;
+ clicks = 0;
+
+ // HostListeners on the entire element
+ @HostListener('click')
+ clicked() {
+ this.clicks += 1;
+ }
+
+ @HostListener('mouseenter', ['$event'])
+ enter(event: Event) {
+ this.active = true;
+ this.headingClass = false;
+ }
+
+ @HostListener('mouseleave', ['$event'])
+ leave(event: Event) {
+ this.active = false;
+ this.headingClass = true;
+ }
+}
+// #enddocregion
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-io.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-io.component.es6
new file mode 100644
index 0000000000..4b36411e78
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-io.component.es6
@@ -0,0 +1,26 @@
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'hero-io',
+ template: `
+
+
+ OK clicked
+ Cancel clicked
+ `
+})
+export class HeroIOComponent {
+ okClicked = false;
+ cancelClicked = false;
+
+ onOk() {
+ this.okClicked = true;
+ }
+
+ onCancel() {
+ this.cancelClicked = true;
+ }
+}
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-lifecycle.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-lifecycle.component.es6
new file mode 100644
index 0000000000..2539266597
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-lifecycle.component.es6
@@ -0,0 +1,14 @@
+// #docregion
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'hero-lifecycle',
+ template: `Hero: {{name}}
`
+})
+export class HeroComponent {
+ name = '';
+ ngOnInit() {
+ // todo: fetch from server async
+ setTimeout(() => this.name = 'Windstorm', 0);
+ }
+}
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-queries.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-queries.component.es6
new file mode 100644
index 0000000000..fced43d4d7
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-queries.component.es6
@@ -0,0 +1,81 @@
+import {
+ Component,
+ ContentChild,
+ Input,
+ QueryList,
+ ViewChildren
+} from '@angular/core';
+
+@Component({
+ selector: 'content-child',
+ template: `
+
+ Active
+ `
+})
+export class ContentChildComponent {
+ active = false;
+
+ activate() {
+ this.active = true;
+ }
+}
+
+////////////////////
+
+// #docregion content
+@Component({
+ selector: 'view-child',
+ template: `
+
+ {{hero.name}}
+
+
`,
+ styles: ['.active {font-weight: bold; background-color: skyblue;}']
+})
+export class ViewChildComponent {
+ @Input() hero;
+ active = false;
+
+ @ContentChild(ContentChildComponent) content;
+
+ activate() {
+ this.active = !this.active;
+ this.content.activate();
+ }
+}
+// #enddocregion content
+
+////////////////////
+
+// #docregion view
+@Component({
+ selector: 'hero-queries',
+ template: `
+
+
+
+
+ `
+})
+export class HeroQueriesComponent {
+ active = false;
+ heroData = [
+ {id: 1, name: 'Windstorm'},
+ {id: 2, name: 'LaughingGas'}
+ ];
+
+ @ViewChildren(ViewChildComponent) views;
+
+ activate() {
+ this.active = !this.active;
+ this.views.forEach(
+ view => view.activate()
+ );
+ }
+
+ get buttonLabel() {
+ return this.active ? 'Deactivate' : 'Activate';
+ }
+}
+// #enddocregion view
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-title.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-title.component.es6
new file mode 100644
index 0000000000..25460d34f7
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-title.component.es6
@@ -0,0 +1,26 @@
+import { Attribute, Component, Inject, Optional } from '@angular/core';
+
+// #docregion
+// #docregion templateUrl
+@Component({
+ moduleId: module.id,
+ selector: 'hero-title',
+ templateUrl: 'hero-title.component.html'
+})
+// #enddocregion templateUrl
+export class HeroTitleComponent {
+ msg = '';
+ constructor(
+ @Inject('titlePrefix') @Optional() titlePrefix,
+ @Attribute('title') title
+ ) {
+ this.titlePrefix = titlePrefix;
+ this.title = title;
+ }
+
+ ok() {
+ this.msg = 'OK!';
+ }
+}
+// #enddocregion
+
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-title.component.html b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-title.component.html
new file mode 100644
index 0000000000..0e93122d5c
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero-title.component.html
@@ -0,0 +1,4 @@
+
+{{titlePrefix}} {{title}}
+
+{{ msg }}
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero.component.es6
new file mode 100644
index 0000000000..4ea4c11611
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/hero.component.es6
@@ -0,0 +1,14 @@
+// #docregion metadata
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'hero-view',
+ template: '{{title}}: {{getName()}}
'
+})
+// #docregion appexport, class
+export class HeroComponent {
+ title = 'Hero Detail';
+ getName() {return 'Windstorm'; }
+}
+// #enddocregion appexport, class
+// #enddocregion metadata
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/main.es6 b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/main.es6
new file mode 100644
index 0000000000..2470c9595e
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/app/main.es6
@@ -0,0 +1,4 @@
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+import { AppModule } from './app.module';
+
+platformBrowserDynamic().bootstrapModule(AppModule);
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/example-config.json b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/example-config.json
new file mode 100644
index 0000000000..391bd1a766
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/example-config.json
@@ -0,0 +1,4 @@
+{
+ "build": "build:babel",
+ "run": "http-server:e2e"
+}
\ No newline at end of file
diff --git a/public/docs/_examples/architecture/ts/mini-app.html b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/index.html
similarity index 82%
rename from public/docs/_examples/architecture/ts/mini-app.html
rename to public/docs/_examples/cb-ts-to-js/js-es6-decorators/index.html
index ecb7dd21ae..1b9e3b5211 100644
--- a/public/docs/_examples/architecture/ts/mini-app.html
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/index.html
@@ -1,10 +1,11 @@
- Architecture of Angular
+
+ TypeScript to JavaScript
@@ -15,7 +16,7 @@
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6-decorators/plnkr.json b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/plnkr.json
new file mode 100644
index 0000000000..5c7a5acd44
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6-decorators/plnkr.json
@@ -0,0 +1,8 @@
+{
+ "description": "TypeScript to JavaScript",
+ "files":[
+ "!**/*.d.ts",
+ "!**/*.js"
+ ],
+ "tags":["cookbook"]
+}
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/.babelrc b/public/docs/_examples/cb-ts-to-js/js-es6/.babelrc
new file mode 100644
index 0000000000..3c078e9f99
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/.babelrc
@@ -0,0 +1,5 @@
+{
+ "presets": [
+ "es2015"
+ ]
+}
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/app.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6/app/app.component.es6
new file mode 100644
index 0000000000..9615b98a1f
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/app.component.es6
@@ -0,0 +1,20 @@
+import { Component } from '@angular/core';
+
+export class AppComponent {
+ constructor() {
+ this.title = 'Plain ES6 JavaScript';
+ }
+}
+
+AppComponent.annotations = [
+ new Component({
+ moduleId: module.id,
+ selector: 'my-app',
+ templateUrl: 'app.component.html',
+ styles: [
+ // See hero-di-inject-additional.component
+ 'hero-host { border: 1px dashed black; display: block; padding: 4px;}',
+ '.heading {font-style: italic}'
+ ]
+ })
+];
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/app.component.html b/public/docs/_examples/cb-ts-to-js/js-es6/app/app.component.html
new file mode 100644
index 0000000000..8fbe65ade6
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/app.component.html
@@ -0,0 +1,30 @@
+
+{{title}}
+Classes and Class Metadata
+Input and Output Metadata
+Dependency Injection
+Host Metadata
+View and Child Metadata
+
+
+
+
+
+
+
+
+
+
+
+Dependency Injection
+
+
+
+
+
+
+
+
+
+
+
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/app.module.es6 b/public/docs/_examples/cb-ts-to-js/js-es6/app/app.module.es6
new file mode 100644
index 0000000000..e8c7a8f9c8
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/app.module.es6
@@ -0,0 +1,56 @@
+import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
+import { BrowserModule } from '@angular/platform-browser';
+
+import { AppComponent } from './app.component';
+import { ConfirmComponent } from './confirm.component';
+// #docregion appimport
+import { HeroComponent } from './hero.component';
+
+// #enddocregion appimport
+import { HeroComponent as HeroDIComponent } from './hero-di.component';
+import { HeroComponent as HeroDIInjectComponent } from './hero-di-inject.component';
+import { HeroComponent as HeroDIInjectAdditionalComponent } from './hero-di-inject-additional.component';
+import { HeroHostComponent } from './hero-host.component';
+import { HeroIOComponent } from './hero-io.component';
+import { HeroComponent as HeroLifecycleComponent } from './hero-lifecycle.component';
+import { HeroQueriesComponent, ViewChildComponent, ContentChildComponent } from './hero-queries.component';
+import { HeroTitleComponent } from './hero-title.component';
+
+import { DataService } from './data.service';
+
+export class AppModule { }
+
+AppModule.annotations = [
+ new NgModule({
+ imports: [ BrowserModule],
+ declarations: [
+ AppComponent,
+ ConfirmComponent,
+ HeroComponent,
+ HeroDIComponent,
+ HeroDIInjectComponent,
+ HeroDIInjectAdditionalComponent,
+ HeroHostComponent,
+ HeroIOComponent,
+ HeroLifecycleComponent,
+ HeroQueriesComponent, ViewChildComponent, ContentChildComponent,
+ HeroTitleComponent
+ ],
+ providers: [
+ DataService,
+ { provide: 'heroName', useValue: 'Windstorm' }
+ ],
+ bootstrap: [ AppComponent ],
+
+ // schemas: [ NO_ERRORS_SCHEMA ] // helpful for debugging
+ })
+]
+
+/* tslint:disable no-unused-variable */
+// #docregion ng2import
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+import {
+ LocationStrategy,
+ HashLocationStrategy
+} from '@angular/common';
+// #enddocregion ng2import
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/confirm.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6/app/confirm.component.es6
new file mode 100644
index 0000000000..d42a553688
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/confirm.component.es6
@@ -0,0 +1,32 @@
+import { Component, EventEmitter } from '@angular/core';
+
+// #docregion
+export class ConfirmComponent {
+ constructor(){
+ this.ok = new EventEmitter();
+ this.notOk = new EventEmitter();
+ }
+ onOkClick() {
+ this.ok.emit(true);
+ }
+ onNotOkClick() {
+ this.notOk.emit(true);
+ }
+}
+
+ConfirmComponent.annotations = [
+ new Component({
+ moduleId: module.id,
+ selector: 'app-confirm',
+ templateUrl: 'confirm.component.html',
+ inputs: [
+ 'okMsg',
+ 'notOkMsg: cancelMsg'
+ ],
+ outputs: [
+ 'ok',
+ 'notOk: cancel'
+ ]
+ })
+];
+// #enddocregion
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/confirm.component.html b/public/docs/_examples/cb-ts-to-js/js-es6/app/confirm.component.html
new file mode 100644
index 0000000000..917bd1696f
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/confirm.component.html
@@ -0,0 +1,6 @@
+
+
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/data.service.es6 b/public/docs/_examples/cb-ts-to-js/js-es6/app/data.service.es6
new file mode 100644
index 0000000000..de023ce5a0
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/data.service.es6
@@ -0,0 +1,13 @@
+import { Injectable } from '@angular/core';
+
+export class DataService {
+ constructor() {
+ }
+ getHeroName() {
+ return 'Windstorm';
+ }
+}
+
+DataService.annotations = [
+ new Injectable()
+];
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-di-inject-additional.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-di-inject-additional.component.es6
new file mode 100644
index 0000000000..5eb9bab815
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-di-inject-additional.component.es6
@@ -0,0 +1,10 @@
+import { Component } from '@angular/core';
+
+export class HeroComponent { }
+
+HeroComponent.annotations = [
+ new Component({
+ selector: 'hero-di-inject-additional',
+ template: ``
+ })
+];
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-di-inject.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-di-inject.component.es6
new file mode 100644
index 0000000000..2f95a0b981
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-di-inject.component.es6
@@ -0,0 +1,20 @@
+import { Component, Inject } from '@angular/core';
+
+// #docregion
+export class HeroComponent {
+ constructor(name) {
+ this.name = name;
+ }
+}
+
+HeroComponent.annotations = [
+ new Component({
+ selector: 'hero-di-inject',
+ template: `Hero: {{name}}
`
+ })
+];
+
+HeroComponent.parameters = [
+ [new Inject('heroName')]
+];
+// #enddocregion
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-di.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-di.component.es6
new file mode 100644
index 0000000000..dfbecf0707
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-di.component.es6
@@ -0,0 +1,22 @@
+import { Component } from '@angular/core';
+import { DataService } from './data.service';
+
+// #docregion
+export class HeroComponent {
+ constructor(dataService) {
+ this.name = dataService.getHeroName();
+ }
+}
+
+HeroComponent.annotations = [
+ new Component({
+ selector: 'hero-di',
+ template: `Hero: {{name}}
`
+ })
+];
+
+HeroComponent.parameters = [
+ [DataService]
+];
+
+// #enddocregion
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-host.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-host.component.es6
new file mode 100644
index 0000000000..092cd1a1ce
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-host.component.es6
@@ -0,0 +1,50 @@
+import { Component } from '@angular/core';
+
+// #docregion
+export class HeroHostComponent {
+ constructor() {
+ this.active = false;
+ this.clicks = 0;
+ this.headingClass = true;
+ this.title = 'Hero Host Tooltip';
+ }
+
+ clicked() {
+ this.clicks += 1;
+ }
+
+ enter(event) {
+ this.active = true;
+ this.headingClass = false;
+ }
+
+ leave(event) {
+ this.active = false;
+ this.headingClass = true;
+ }
+}
+
+// #docregion metadata
+HeroHostComponent.annotations = [
+ new Component({
+ selector: 'hero-host',
+ template: `
+ Hero Host
+ Heading clicks: {{clicks}}
+ `,
+ host: {
+ // HostBindings to the element
+ '[title]': 'title',
+ '[class.heading]': 'headingClass',
+ '(click)': 'clicked()',
+
+ // HostListeners on the entire element
+ '(mouseenter)': 'enter($event)',
+ '(mouseleave)': 'leave($event)'
+ },
+ // Styles within (but excluding) the element
+ styles: ['.active {background-color: yellow;}']
+ })
+];
+// #docregion metadata
+// #enddocregion
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-io.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-io.component.es6
new file mode 100644
index 0000000000..0dc8c08f2d
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-io.component.es6
@@ -0,0 +1,31 @@
+import { Component } from '@angular/core';
+
+export class HeroIOComponent {
+ constructor() {
+ this.okClicked = false;
+ this.cancelClicked = false;
+ }
+
+ onOk() {
+ this.okClicked = true;
+ }
+
+ onCancel() {
+ this.cancelClicked = true;
+ }
+}
+
+HeroIOComponent.annotations = [
+ new Component({
+ selector: 'hero-io',
+ template: `
+
+
+ OK clicked
+ Cancel clicked
+ `
+ })
+];
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-lifecycle.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-lifecycle.component.es6
new file mode 100644
index 0000000000..b394ff59aa
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-lifecycle.component.es6
@@ -0,0 +1,15 @@
+// #docregion
+import { Component } from '@angular/core';
+export class HeroComponent {
+ ngOnInit() {
+ // todo: fetch from server async
+ setTimeout(() => this.name = 'Windstorm', 0);
+ }
+}
+
+HeroComponent.annotations = [
+ new Component({
+ selector: 'hero-lifecycle',
+ template: `Hero: {{name}}
`
+ })
+];
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-queries.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-queries.component.es6
new file mode 100644
index 0000000000..bf3b914406
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-queries.component.es6
@@ -0,0 +1,97 @@
+import {
+ Component,
+ ContentChild,
+ Input,
+ QueryList,
+ ViewChildren
+} from '@angular/core';
+
+export class ContentChildComponent {
+ constructor() {
+ this.active = false;
+ }
+
+ activate() {
+ this.active = !this.active;
+ }
+}
+
+ContentChildComponent.annotations = [
+ new Component({
+ selector: 'content-child',
+ template: `
+
+ Active
+ `
+ })
+];
+
+////////////////////
+
+// #docregion content
+export class ViewChildComponent {
+ constructor() {
+ this.active = false;
+ }
+
+ activate() {
+ this.active = !this.active;
+ this.content.activate();
+ }
+}
+
+ViewChildComponent.annotations = [
+ new Component({
+ selector: 'view-child',
+ template: `
+ {{hero.name}}
+
+
`,
+ styles: ['.active {font-weight: bold; background-color: skyblue;}'],
+ inputs: ['hero'],
+ queries: {
+ content: new ContentChild(ContentChildComponent)
+ }
+ })
+];
+// #enddocregion content
+
+////////////////////
+
+// #docregion view
+export class HeroQueriesComponent {
+ constructor(){
+ this.active = false;
+ this.heroData = [
+ {id: 1, name: 'Windstorm'},
+ {id: 2, name: 'LaughingGas'}
+ ];
+ }
+
+ activate() {
+ this.active = !this.active;
+ this.views.forEach(
+ view => view.activate()
+ );
+ }
+
+ get buttonLabel() {
+ return this.active ? 'Deactivate' : 'Activate';
+ }
+}
+
+HeroQueriesComponent.annotations = [
+ new Component({
+ selector: 'hero-queries',
+ template: `
+
+
+
+
+ `,
+ queries: {
+ views: new ViewChildren(ViewChildComponent)
+ }
+ })
+];
+// #enddocregion view
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-title.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-title.component.es6
new file mode 100644
index 0000000000..ff1e6ce026
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-title.component.es6
@@ -0,0 +1,29 @@
+import { Attribute, Component, Inject, Optional } from '@angular/core';
+
+// #docregion
+export class HeroTitleComponent {
+ constructor(titlePrefix, title) {
+ this.titlePrefix = titlePrefix;
+ this.title = title;
+ this.msg = '';
+ }
+
+ ok() {
+ this.msg = 'OK!';
+ }
+}
+
+// #docregion templateUrl
+HeroTitleComponent.annotations = [
+ new Component({
+ moduleId: module.id,
+ selector: 'hero-title',
+ templateUrl: 'hero-title.component.html'
+ })
+];
+// #enddocregion templateUrl
+
+HeroTitleComponent.parameters = [
+ [new Optional(), new Inject('titlePrefix')],
+ [new Attribute('title')]
+];
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-title.component.html b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-title.component.html
new file mode 100644
index 0000000000..0e93122d5c
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-title.component.html
@@ -0,0 +1,4 @@
+
+{{titlePrefix}} {{title}}
+
+{{ msg }}
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/hero.component.es6 b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero.component.es6
new file mode 100644
index 0000000000..10b92c2878
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/hero.component.es6
@@ -0,0 +1,20 @@
+// #docplaster
+// #docregion metadata
+import { Component } from '@angular/core';
+
+// #docregion appexport, class
+export class HeroComponent {
+ constructor() {
+ this.title = 'Hero Detail';
+ }
+ getName() {return 'Windstorm'; }
+}
+// #enddocregion appexport, class
+
+HeroComponent.annotations = [
+ new Component({
+ selector: 'hero-view',
+ template: '{{title}}: {{getName()}}
'
+ })
+];
+// #enddocregion metadata
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/app/main.es6 b/public/docs/_examples/cb-ts-to-js/js-es6/app/main.es6
new file mode 100644
index 0000000000..2470c9595e
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/app/main.es6
@@ -0,0 +1,4 @@
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+import { AppModule } from './app.module';
+
+platformBrowserDynamic().bootstrapModule(AppModule);
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/example-config.json b/public/docs/_examples/cb-ts-to-js/js-es6/example-config.json
new file mode 100644
index 0000000000..391bd1a766
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/example-config.json
@@ -0,0 +1,4 @@
+{
+ "build": "build:babel",
+ "run": "http-server:e2e"
+}
\ No newline at end of file
diff --git a/public/docs/_examples/upgrade-adapter/ts/index-1-2-hybrid-shared-adapter-bootstrap.html b/public/docs/_examples/cb-ts-to-js/js-es6/index.html
similarity index 61%
rename from public/docs/_examples/upgrade-adapter/ts/index-1-2-hybrid-shared-adapter-bootstrap.html
rename to public/docs/_examples/cb-ts-to-js/js-es6/index.html
index 67d9b04e44..1b9e3b5211 100644
--- a/public/docs/_examples/upgrade-adapter/ts/index-1-2-hybrid-shared-adapter-bootstrap.html
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/index.html
@@ -1,12 +1,11 @@
-
+
- Angular 2 Upgrade
+
-
-
+ TypeScript to JavaScript
@@ -17,12 +16,12 @@
- {{ mainCtrl.message }}
+ Loading...
+
diff --git a/public/docs/_examples/cb-ts-to-js/js-es6/plnkr.json b/public/docs/_examples/cb-ts-to-js/js-es6/plnkr.json
new file mode 100644
index 0000000000..5c7a5acd44
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js-es6/plnkr.json
@@ -0,0 +1,8 @@
+{
+ "description": "TypeScript to JavaScript",
+ "files":[
+ "!**/*.d.ts",
+ "!**/*.js"
+ ],
+ "tags":["cookbook"]
+}
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/app.component.html b/public/docs/_examples/cb-ts-to-js/js/app/app.component.html
new file mode 100644
index 0000000000..6681d60672
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js/app/app.component.html
@@ -0,0 +1,47 @@
+
+{{title}}
+Classes and Class Metadata
+Interfaces
+Input and Output Metadata
+Dependency Injection
+Host Metadata
+View and Child Metadata
+
+
+
+
+
+
+
+
+Interfaces
+
+Interfaces (DSL)
+
+
+
+
+
+
+
+
+
+Dependency Injection
+
+
+
+
+Dependency Injection (DSL)
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/app.component.js b/public/docs/_examples/cb-ts-to-js/js/app/app.component.js
new file mode 100644
index 0000000000..9e8c5da535
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js/app/app.component.js
@@ -0,0 +1,20 @@
+(function(app) {
+
+app.AppComponent = AppComponent;
+function AppComponent() {
+ this.title = 'ES5 JavaScript';
+}
+
+AppComponent.annotations = [
+ new ng.core.Component({
+ selector: 'my-app',
+ templateUrl: 'app/app.component.html',
+ styles: [
+ // See hero-di-inject-additional.component
+ 'hero-host, hero-host-dsl { border: 1px dashed black; display: block; padding: 4px;}',
+ '.heading {font-style: italic}'
+ ]
+ })
+];
+
+})(window.app = window.app || {});
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/app.module.js b/public/docs/_examples/cb-ts-to-js/js/app/app.module.js
new file mode 100644
index 0000000000..3791fe16da
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js/app/app.module.js
@@ -0,0 +1,46 @@
+(function(app) {
+
+app.AppModule = AppModule;
+function AppModule() { }
+
+AppModule.annotations = [
+ new ng.core.NgModule({
+ imports: [ ng.platformBrowser.BrowserModule ],
+ declarations: [
+ app.AppComponent,
+ app.ConfirmComponent, app.ConfirmDslComponent,
+ app.HeroComponent, app.HeroDslComponent,
+ app.HeroDIComponent, app.HeroDIDslComponent,
+ app.HeroDIInjectComponent, app.HeroDIInjectDslComponent,
+ app.HeroDIInjectAdditionalComponent, app.HeroDIInjectAdditionalDslComponent,
+ app.HeroHostComponent, app.HeroHostDslComponent,
+ app.HeroIOComponent, app.HeroIODslComponent,
+ app.HeroLifecycleComponent, app.HeroLifecycleDslComponent,
+ app.heroQueries.HeroQueriesComponent, app.heroQueries.ViewChildComponent, app.heroQueries.ContentChildComponent,
+ app.HeroTitleComponent, app.HeroTitleDslComponent
+ ],
+ providers: [
+ app.DataService,
+ { provide: 'heroName', useValue: 'Windstorm' }
+ ],
+ bootstrap: [ app.AppComponent ],
+
+ // schemas: [ ng.core.NO_ERRORS_SCHEMA ] // helpful for debugging!
+ })
+]
+
+})(window.app = window.app || {});
+
+
+///// For documentation only /////
+(function () {
+ // #docregion appimport
+ var HeroComponent = app.HeroComponent;
+ // #enddocregion appimport
+
+ // #docregion ng2import
+ var platformBrowserDynamic = ng.platformBrowserDynamic.platformBrowserDynamic;
+ var LocationStrategy = ng.common.LocationStrategy;
+ var HashLocationStrategy = ng.common.HashLocationStrategy;
+ // #enddocregion ng2import
+})
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/confirm.component.html b/public/docs/_examples/cb-ts-to-js/js/app/confirm.component.html
new file mode 100644
index 0000000000..917bd1696f
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js/app/confirm.component.html
@@ -0,0 +1,6 @@
+
+
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/confirm.component.js b/public/docs/_examples/cb-ts-to-js/js/app/confirm.component.js
new file mode 100644
index 0000000000..4a4cd0a470
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js/app/confirm.component.js
@@ -0,0 +1,73 @@
+(function(app) {
+
+// #docregion
+app.ConfirmComponent = ConfirmComponent;
+
+ConfirmComponent.annotations = [
+ new ng.core.Component({
+ selector: 'app-confirm',
+ templateUrl: 'app/confirm.component.html',
+ inputs: [
+ 'okMsg',
+ 'notOkMsg: cancelMsg'
+ ],
+ outputs: [
+ 'ok',
+ 'notOk: cancel'
+ ]
+ })
+];
+
+function ConfirmComponent() {
+ this.ok = new ng.core.EventEmitter();
+ this.notOk = new ng.core.EventEmitter();
+}
+
+ConfirmComponent.prototype.onOkClick = function() {
+ this.ok.emit(true);
+}
+
+ConfirmComponent.prototype.onNotOkClick = function() {
+ this.notOk.emit(true);
+}
+
+
+// #enddocregion
+
+})(window.app = window.app || {});
+
+/////// DSL version ////////
+
+(function(app) {
+
+// #docregion dsl
+app.ConfirmDslComponent = ng.core.Component({
+ selector: 'app-confirm-dsl',
+ templateUrl: 'app/confirm.component.html',
+ inputs: [
+ 'okMsg',
+ 'notOkMsg: cancelMsg'
+ ],
+ outputs: [
+ 'ok',
+ 'notOk: cancel'
+ ]
+ })
+ .Class({
+ constructor: function ConfirmDslComponent() {
+ this.ok = new ng.core.EventEmitter();
+ this.notOk = new ng.core.EventEmitter();
+ },
+
+ onOkClick: function() {
+ this.ok.emit(true);
+ },
+
+ onNotOkClick: function() {
+ this.notOk.emit(true);
+ }
+ });
+
+// #enddocregion dsl
+
+})(window.app = window.app || {});
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/data.service.js b/public/docs/_examples/cb-ts-to-js/js/app/data.service.js
index c060e2b39d..643bb57dca 100644
--- a/public/docs/_examples/cb-ts-to-js/js/app/data.service.js
+++ b/public/docs/_examples/cb-ts-to-js/js/app/data.service.js
@@ -1,13 +1,10 @@
(function(app) {
- function DataService() {
- }
- DataService.annotations = [
- new ng.core.Injectable()
- ];
+ app.DataService = DataService;
+ function DataService() { }
+
DataService.prototype.getHeroName = function() {
return 'Windstorm';
};
- app.DataService = DataService;
})(window.app = window.app || {});
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/hero-di-inject-additional.component.js b/public/docs/_examples/cb-ts-to-js/js/app/hero-di-inject-additional.component.js
index fa9684e7a1..1a88cfa355 100644
--- a/public/docs/_examples/cb-ts-to-js/js/app/hero-di-inject-additional.component.js
+++ b/public/docs/_examples/cb-ts-to-js/js/app/hero-di-inject-additional.component.js
@@ -1,50 +1,26 @@
(function(app) {
- // #docregion
- var TitleComponent = ng.core.Component({
- selector: 'hero-title',
- template:
- '{{titlePrefix}} {{title}}
' +
- '' +
- '{{ msg }}
'
- }).Class({
- constructor: [
- [
- new ng.core.Optional(),
- new ng.core.Inject('titlePrefix')
- ],
- new ng.core.Attribute('title'),
- function(titlePrefix, title) {
- this.titlePrefix = titlePrefix;
- this.title = title;
- this.msg = '';
- }
- ],
- ok: function() {
- this.msg = 'OK!';
- }
- });
- // #enddocregion
+app.HeroDIInjectAdditionalComponent = HeroDIInjectAdditionalComponent;
- var AppComponent = ng.core.Component({
+HeroDIInjectAdditionalComponent.annotations = [
+ new ng.core.Component({
selector: 'hero-di-inject-additional',
- template: '' +
- ''
- }).Class({
- constructor: function() { }
- });
-
- app.HeroesDIInjectAdditionalModule =
- ng.core.NgModule({
- imports: [ ng.platformBrowser.BrowserModule ],
- declarations: [
- AppComponent,
- TitleComponent
- ],
- bootstrap: [ AppComponent ]
- })
- .Class({
- constructor: function() {}
- });
+ template: ''
+ })
+];
+
+function HeroDIInjectAdditionalComponent() {}
+
+})(window.app = window.app || {});
+
+////// DSL Version /////////
+(function(app) {
+
+app.HeroDIInjectAdditionalDslComponent = ng.core.Component({
+ selector: 'hero-di-inject-additional-dsl',
+ template: ''
+}).Class({
+ constructor: function HeroDIInjectAdditionalDslComponent() { }
+});
})(window.app = window.app || {});
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/hero-di-inject.component.js b/public/docs/_examples/cb-ts-to-js/js/app/hero-di-inject.component.js
index dfda83e1f0..2e04c9246e 100644
--- a/public/docs/_examples/cb-ts-to-js/js/app/hero-di-inject.component.js
+++ b/public/docs/_examples/cb-ts-to-js/js/app/hero-di-inject.component.js
@@ -1,57 +1,41 @@
(function(app) {
-// #docregion parameters
- function HeroComponent(name) {
- this.name = name;
- }
- HeroComponent.parameters = [
- 'heroName'
- ];
- HeroComponent.annotations = [
- new ng.core.Component({
- selector: 'hero-di-inject',
- template: 'Hero: {{name}}
'
- })
- ];
-// #enddocregion parameters
+// #docregion
+app.HeroDIInjectComponent = HeroDIInjectComponent;
- app.HeroesDIInjectModule =
- ng.core.NgModule({
- imports: [ ng.platformBrowser.BrowserModule ],
- providers: [ { provide: 'heroName', useValue: 'Windstorm' } ],
- declarations: [ HeroComponent ],
- bootstrap: [ HeroComponent ]
- })
- .Class({
- constructor: function() {}
- });
-
-})(window.app = window.app || {});
-
-(function(app) {
-// #docregion ctor
- var HeroComponent = ng.core.Component({
- selector: 'hero-di-inline2',
+HeroDIInjectComponent.annotations = [
+ new ng.core.Component({
+ selector: 'hero-di-inject',
template: 'Hero: {{name}}
'
})
- .Class({
- constructor:
- [new ng.core.Inject('heroName'),
- function(name) {
- this.name = name;
- }]
- });
-// #enddocregion ctor
+];
- app.HeroesDIInjectModule2 =
- ng.core.NgModule({
- imports: [ ng.platformBrowser.BrowserModule ],
- providers: [ { provide: 'heroName', useValue: 'Bombasto' } ],
- declarations: [ HeroComponent ],
- bootstrap: [ HeroComponent ]
- })
- .Class({
- constructor: function() {}
- });
+HeroDIInjectComponent.parameters = [ 'heroName' ];
+
+function HeroDIInjectComponent(name) {
+ this.name = name;
+}
+// #enddocregion
+
+})(window.app = window.app || {});
+
+/////// DSL version ////////
+
+(function(app) {
+
+// #docregion dsl
+app.HeroDIInjectDslComponent = ng.core.Component({
+ selector: 'hero-di-inject-dsl',
+ template: 'Hero: {{name}}
'
+})
+.Class({
+ constructor: [
+ new ng.core.Inject('heroName'),
+ function HeroDIInjectDslComponent(name) {
+ this.name = name;
+ }
+ ]
+});
+// #enddocregion dsl
})(window.app = window.app || {});
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/hero-di-inline.component.js b/public/docs/_examples/cb-ts-to-js/js/app/hero-di-inline.component.js
deleted file mode 100644
index 1fe9c38cb1..0000000000
--- a/public/docs/_examples/cb-ts-to-js/js/app/hero-di-inline.component.js
+++ /dev/null
@@ -1,27 +0,0 @@
-(function(app) {
- // #docregion
- var HeroComponent = ng.core.Component({
- selector: 'hero-di-inline',
- template: 'Hero: {{name}}
'
- })
- .Class({
- constructor:
- [app.DataService,
- function(service) {
- this.name = service.getHeroName();
- }]
- });
- // #enddocregion
-
- app.HeroDIInlineModule =
- ng.core.NgModule({
- imports: [ ng.platformBrowser.BrowserModule ],
- providers: [ app.DataService ],
- declarations: [ HeroComponent ],
- bootstrap: [ HeroComponent ]
- })
- .Class({
- constructor: function() {}
- });
-
-})(window.app = window.app || {});
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/hero-di.component.js b/public/docs/_examples/cb-ts-to-js/js/app/hero-di.component.js
index 55c576b836..c80efe193e 100644
--- a/public/docs/_examples/cb-ts-to-js/js/app/hero-di.component.js
+++ b/public/docs/_examples/cb-ts-to-js/js/app/hero-di.component.js
@@ -1,31 +1,43 @@
(function(app) {
// #docregion
- app.HeroDIComponent = HeroComponent;
-
- function HeroComponent(dataService) {
- this.name = dataService.getHeroName();
- }
- HeroComponent.parameters = [
- app.DataService
- ];
- HeroComponent.annotations = [
+ app.HeroDIComponent = HeroDIComponent;
+
+ HeroDIComponent.annotations = [
new ng.core.Component({
selector: 'hero-di',
template: 'Hero: {{name}}
'
})
];
+
+ HeroDIComponent.parameters = [ app.DataService ];
+
+ function HeroDIComponent(dataService) {
+ this.name = dataService.getHeroName();
+ }
+
// #enddocregion
- app.HeroesDIModule =
- ng.core.NgModule({
- imports: [ ng.platformBrowser.BrowserModule ],
- providers: [ app.DataService ],
- declarations: [ HeroComponent ],
- bootstrap: [ HeroComponent ]
- })
- .Class({
- constructor: function() {}
- });
+
+})(window.app = window.app || {});
+
+////// DSL Version /////
+
+(function(app) {
+
+// #docregion dsl
+app.HeroDIDslComponent = ng.core.Component({
+ selector: 'hero-di-dsl',
+ template: 'Hero: {{name}}
'
+})
+.Class({
+ constructor: [
+ app.DataService,
+ function HeroDIDslComponent(service) {
+ this.name = service.getHeroName();
+ }
+ ]
+});
+// #enddocregion dsl
})(window.app = window.app || {});
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/hero-dsl.component.js b/public/docs/_examples/cb-ts-to-js/js/app/hero-dsl.component.js
deleted file mode 100644
index 5dd84733f3..0000000000
--- a/public/docs/_examples/cb-ts-to-js/js/app/hero-dsl.component.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// #docplaster
-// #docregion appexport
-(function(app) {
-
- // #docregion component
- var HeroComponent = ng.core.Component({
- selector: 'hero-view-2',
- template:
- 'Name: {{getName()}}
',
- })
- .Class({
- constructor: function() {
- },
- getName: function() {
- return 'Windstorm';
- }
- });
- // #enddocregion component
-
- app.HeroesDslModule =
- ng.core.NgModule({
- imports: [ ng.platformBrowser.BrowserModule ],
- declarations: [ HeroComponent ],
- bootstrap: [ HeroComponent ]
- })
- .Class({
- constructor: function() {}
- });
-
-})(window.app = window.app || {});
-// #enddocregion appexport
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/hero-host.component.js b/public/docs/_examples/cb-ts-to-js/js/app/hero-host.component.js
new file mode 100644
index 0000000000..0b04d5efae
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js/app/hero-host.component.js
@@ -0,0 +1,97 @@
+(function(app) {
+
+// #docregion
+app.HeroHostComponent = HeroHostComponent;
+
+HeroHostComponent.annotations = [
+ new ng.core.Component({
+ selector: 'hero-host',
+ template:
+ 'Hero Host
' +
+ 'Heading clicks: {{clicks}}
',
+ host: {
+ // HostBindings to the element
+ '[title]': 'title',
+ '[class.heading]': 'headingClass',
+ '(click)': 'clicked()',
+
+ // HostListeners on the entire element
+ '(mouseenter)': 'enter($event)',
+ '(mouseleave)': 'leave($event)'
+ },
+ // Styles within (but excluding) the element
+ styles: ['.active {background-color: yellow;}']
+ })
+];
+
+function HeroHostComponent() {
+ this.clicks = 0;
+ this.headingClass = true;
+ this.title = 'Hero Host Tooltip content';
+}
+
+HeroHostComponent.prototype.clicked = function() {
+ this.clicks += 1;
+}
+
+HeroHostComponent.prototype.enter = function(event) {
+ this.active = true;
+ this.headingClass = false;
+}
+
+HeroHostComponent.prototype.leave = function(event) {
+ this.active = false;
+ this.headingClass = true;
+}
+// #enddocregion
+
+})(window.app = window.app || {});
+
+//// DSL Version ////
+
+(function(app) {
+
+// #docregion dsl
+app.HeroHostDslComponent = ng.core.Component({
+ selector: 'hero-host-dsl',
+ template: `
+ Hero Host (DSL)
+ Heading clicks: {{clicks}}
+ `,
+ host: {
+ // HostBindings to the element
+ '[title]': 'title',
+ '[class.heading]': 'headingClass',
+ '(click)': 'clicked()',
+
+ // HostListeners on the entire element
+ '(mouseenter)': 'enter($event)',
+ '(mouseleave)': 'leave($event)'
+ },
+ // Styles within (but excluding) the element
+ styles: ['.active {background-color: coral;}']
+})
+.Class({
+ constructor: function HeroHostDslComponent() {
+ this.clicks = 0;
+ this.headingClass = true;
+ this.title = 'Hero Host Tooltip DSL content';
+ },
+
+ clicked() {
+ this.clicks += 1;
+ },
+
+ enter(event) {
+ this.active = true;
+ this.headingClass = false;
+ },
+
+ leave(event) {
+ this.active = false;
+ this.headingClass = true;
+ }
+});
+// #enddocregion dsl
+
+})(window.app = window.app || {});
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/hero-io-dsl.component.html b/public/docs/_examples/cb-ts-to-js/js/app/hero-io-dsl.component.html
new file mode 100644
index 0000000000..48c491be35
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js/app/hero-io-dsl.component.html
@@ -0,0 +1,7 @@
+
+
+OK clicked
+Cancel clicked
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/hero-io.component.html b/public/docs/_examples/cb-ts-to-js/js/app/hero-io.component.html
new file mode 100644
index 0000000000..e6eae2e804
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js/app/hero-io.component.html
@@ -0,0 +1,7 @@
+
+
+OK clicked
+Cancel clicked
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/hero-io.component.js b/public/docs/_examples/cb-ts-to-js/js/app/hero-io.component.js
index 79aef12125..d35f3762da 100644
--- a/public/docs/_examples/cb-ts-to-js/js/app/hero-io.component.js
+++ b/public/docs/_examples/cb-ts-to-js/js/app/hero-io.component.js
@@ -1,68 +1,42 @@
(function(app) {
- // #docregion
- var ConfirmComponent = ng.core.Component({
- selector: 'my-confirm',
- inputs: [
- 'okMsg',
- 'notOkMsg: cancelMsg'
- ],
- outputs: [
- 'ok',
- 'notOk: cancel'
- ],
- template:
- '' +
- ''
- }).Class({
- constructor: function() {
- this.ok = new ng.core.EventEmitter();
- this.notOk = new ng.core.EventEmitter();
- },
- onOkClick: function() {
- this.ok.next(true);
- },
- onNotOkClick: function() {
- this.notOk.next(true);
- }
- });
- // #enddocregion
- function AppComponent() {
- }
- AppComponent.annotations = [
- new ng.core.Component({
- selector: 'hero-io',
- template: '' +
- '' +
- 'OK clicked' +
- 'Cancel clicked'
- })
- ];
- AppComponent.prototype.onOk = function() {
- this.okClicked = true;
- }
- AppComponent.prototype.onCancel = function() {
- this.cancelClicked = true;
- }
+app.HeroIOComponent = HeroComponent;
- app.HeroesIOModule =
- ng.core.NgModule({
- imports: [ ng.platformBrowser.BrowserModule ],
- declarations: [
- AppComponent,
- ConfirmComponent
- ],
- bootstrap: [ AppComponent ]
- })
- .Class({
- constructor: function() {}
- });
+HeroComponent.annotations = [
+ new ng.core.Component({
+ selector: 'hero-io',
+ templateUrl: 'app/hero-io.component.html'
+ })
+];
+
+function HeroComponent() { }
+
+HeroComponent.prototype.onOk = function() {
+ this.okClicked = true;
+}
+
+HeroComponent.prototype.onCancel = function() {
+ this.cancelClicked = true;
+}
+
+})(window.app = window.app || {});
+
+///// DSL Version ////
+
+(function(app) {
+
+app.HeroIODslComponent = ng.core.Component({
+ selector: 'hero-io-dsl',
+ templateUrl: 'app/hero-io-dsl.component.html'
+ })
+ .Class({
+ constructor: function HeroIODslComponent() { },
+ onOk: function() {
+ this.okClicked = true;
+ },
+ onCancel: function() {
+ this.cancelClicked = true;
+ }
+ });
})(window.app = window.app || {});
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/hero-lifecycle.component.js b/public/docs/_examples/cb-ts-to-js/js/app/hero-lifecycle.component.js
index 3e81c72e4e..94aa3514b2 100644
--- a/public/docs/_examples/cb-ts-to-js/js/app/hero-lifecycle.component.js
+++ b/public/docs/_examples/cb-ts-to-js/js/app/hero-lifecycle.component.js
@@ -1,29 +1,42 @@
// #docplaster
(function(app) {
- // #docregion
- function HeroComponent() {}
- // #enddocregion
- HeroComponent.annotations = [
- new ng.core.Component({
- selector: 'hero-lifecycle',
- template: 'Hero: {{name}}
'
- })
- ];
- // #docregion
- HeroComponent.prototype.ngOnInit =
- function() {
- this.name = 'Windstorm';
- };
- // #enddocregion
- app.HeroesLifecycleModule =
- ng.core.NgModule({
- imports: [ ng.platformBrowser.BrowserModule ],
- declarations: [ HeroComponent ],
- bootstrap: [ HeroComponent ]
- })
- .Class({
- constructor: function() {}
- });
+// #docregion
+app.HeroLifecycleComponent = HeroComponent;
+
+HeroComponent.annotations = [
+ new ng.core.Component({
+ selector: 'hero-lifecycle',
+ template: 'Hero: {{name}}
'
+ })
+];
+
+function HeroComponent() { }
+
+HeroComponent.prototype.ngOnInit = function() {
+ // todo: fetch from server async
+ setTimeout(() => this.name = 'Windstorm', 0);
+};
+// #enddocregion
+
+})(window.app = window.app || {});
+
+/////// DSL version ////
+
+(function(app) {
+
+// #docregion dsl
+app.HeroLifecycleDslComponent = ng.core.Component({
+ selector: 'hero-lifecycle-dsl',
+ template: 'Hero: {{name}}
'
+ })
+ .Class({
+ constructor: function HeroLifecycleDslComponent() { },
+ ngOnInit: function() {
+ // todo: fetch from server async
+ setTimeout(() => this.name = 'Windstorm', 0);
+ }
+ });
+// #enddocregion dsl
})(window.app = window.app || {});
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/hero-queries.component.js b/public/docs/_examples/cb-ts-to-js/js/app/hero-queries.component.js
new file mode 100644
index 0000000000..5e21cfcb0b
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js/app/hero-queries.component.js
@@ -0,0 +1,92 @@
+(function(app) {
+
+app.heroQueries = app.heroQueries || {};
+
+app.heroQueries.ContentChildComponent = ng.core.Component({
+ selector: 'content-child',
+ template:
+ '' +
+ 'Active' +
+ ''
+}).Class({
+ constructor: function ContentChildComponent() {
+ this.active = false;
+ },
+
+ activate: function() {
+ this.active = !this.active;
+ }
+});
+
+////////////////////
+
+// #docregion content
+app.heroQueries.ViewChildComponent = ng.core.Component({
+ selector: 'view-child',
+ template:
+ '' +
+ '{{hero.name}} ' +
+ '' +
+ '
',
+ styles: ['.active {font-weight: bold; background-color: skyblue;}'],
+ inputs: ['hero'],
+ queries: {
+ content: new ng.core.ContentChild(app.heroQueries.ContentChildComponent)
+ }
+})
+.Class({
+ constructor: function HeroQueriesHeroComponent() {
+ this.active = false;
+ },
+
+ activate: function() {
+ this.active = !this.active;
+ this.content.activate();
+ }
+});
+// #enddocregion content
+
+////////////////////
+
+// #docregion view
+app.heroQueries.HeroQueriesComponent = ng.core.Component({
+ selector: 'hero-queries',
+ template:
+ '' +
+ '' +
+ '' +
+ '',
+ queries: {
+ views: new ng.core.ViewChildren(app.heroQueries.ViewChildComponent)
+ }
+})
+.Class({
+ constructor: function HeroQueriesComponent() {
+ this.active = false;
+ this.heroData = [
+ {id: 1, name: 'Windstorm'},
+ {id: 2, name: 'LaughingGas'}
+ ];
+ },
+
+ activate: function() {
+ this.active = !this.active;
+ this.views.forEach(function(view) {
+ view.activate();
+ });
+ },
+});
+
+// #docregion defined-property
+// add prototype property w/ getter outside the DSL
+var proto = app.heroQueries.HeroQueriesComponent.prototype;
+Object.defineProperty(proto, "buttonLabel", {
+ get: function () {
+ return this.active ? 'Deactivate' : 'Activate';
+ },
+ enumerable: true
+});
+// #enddocregion defined-property
+// #enddocregion view
+
+})(window.app = window.app || {});
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/hero-title.component.html b/public/docs/_examples/cb-ts-to-js/js/app/hero-title.component.html
new file mode 100644
index 0000000000..0e93122d5c
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js/app/hero-title.component.html
@@ -0,0 +1,4 @@
+
+{{titlePrefix}} {{title}}
+
+{{ msg }}
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/hero-title.component.js b/public/docs/_examples/cb-ts-to-js/js/app/hero-title.component.js
new file mode 100644
index 0000000000..9a8ce7e578
--- /dev/null
+++ b/public/docs/_examples/cb-ts-to-js/js/app/hero-title.component.js
@@ -0,0 +1,60 @@
+(function(app) {
+
+// #docregion
+app.HeroTitleComponent = HeroTitleComponent;
+
+// #docregion templateUrl
+HeroTitleComponent.annotations = [
+ new ng.core.Component({
+ selector: 'hero-title',
+ templateUrl: 'app/hero-title.component.html'
+ })
+];
+// #enddocregion templateUrl
+
+function HeroTitleComponent(titlePrefix, title) {
+ this.titlePrefix = titlePrefix;
+ this.title = title;
+ this.msg = '';
+}
+
+HeroTitleComponent.prototype.ok = function() {
+ this.msg = 'OK!';
+}
+
+HeroTitleComponent.parameters = [
+ [new ng.core.Optional(), new ng.core.Inject('titlePrefix')],
+ [new ng.core.Attribute('title')]
+];
+
+// #enddocregion
+
+})(window.app = window.app || {});
+
+////////// DSL version ////////////
+
+(function(app) {
+
+// #docregion dsl
+app.HeroTitleDslComponent = ng.core.Component({
+ selector: 'hero-title-dsl',
+ templateUrl: 'app/hero-title.component.html'
+})
+.Class({
+ constructor: [
+ [ new ng.core.Optional(), new ng.core.Inject('titlePrefix') ],
+ new ng.core.Attribute('title'),
+ function HeroTitleDslComponent(titlePrefix, title) {
+ this.titlePrefix = titlePrefix;
+ this.title = title;
+ this.msg = '';
+ }
+ ],
+
+ ok: function() {
+ this.msg = 'OK!';
+ }
+});
+// #enddocregion dsl
+
+})(window.app = window.app || {});
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/hero.component.js b/public/docs/_examples/cb-ts-to-js/js/app/hero.component.js
index c6a58acc56..346d6f03d8 100644
--- a/public/docs/_examples/cb-ts-to-js/js/app/hero.component.js
+++ b/public/docs/_examples/cb-ts-to-js/js/app/hero.component.js
@@ -1,42 +1,48 @@
// #docplaster
-// #docregion appexport
(function(app) {
- // #enddocregion appexport
- // #docregion metadata
- // #docregion appexport
- // #docregion constructorproto
- function HeroComponent() {
- this.title = "Hero Detail";
- }
-
- // #enddocregion constructorproto
- // #enddocregion appexport
- HeroComponent.annotations = [
- new ng.core.Component({
- selector: 'hero-view',
- template:
- 'Hero: {{getName()}}
'
- })
- ];
- // #docregion constructorproto
- HeroComponent.prototype.getName =
- function() {return 'Windstorm';};
- // #enddocregion constructorproto
- // #enddocregion metadata
+// #docregion
+// #docregion appexport
+// #docregion metadata
+app.HeroComponent = HeroComponent; // "export"
- app.HeroesModule =
- ng.core.NgModule({
- imports: [ ng.platformBrowser.BrowserModule ],
- declarations: [ HeroComponent ],
- bootstrap: [ HeroComponent ]
- })
- .Class({
- constructor: function() {}
- });
+HeroComponent.annotations = [
+ new ng.core.Component({
+ selector: 'hero-view',
+ template: '{{title}}: {{getName()}}
'
+ })
+];
- // #docregion appexport
- app.HeroComponent = HeroComponent;
+// #docregion constructorproto
+function HeroComponent() {
+ this.title = "Hero Detail";
+}
+
+HeroComponent.prototype.getName = function() { return 'Windstorm'; };
+// #enddocregion constructorproto
+
+// #enddocregion metadata
+// #enddocregion appexport
+// #enddocregion
+
+})(window.app = window.app || {});
+
+//////////// DSL version ///////////
+
+(function(app) {
+
+// #docregion dsl
+app.HeroDslComponent = ng.core.Component({
+ selector: 'hero-view-dsl',
+ template: '{{title}}: {{getName()}}
',
+ })
+ .Class({
+ constructor: function HeroDslComponent() {
+ this.title = "Hero Detail";
+ },
+
+ getName: function() { return 'Windstorm'; }
+ });
+// #enddocregion dsl
})(window.app = window.app || {});
-// #enddocregion appexport
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/heroes-bindings.component.js b/public/docs/_examples/cb-ts-to-js/js/app/heroes-bindings.component.js
deleted file mode 100644
index 3a562d6912..0000000000
--- a/public/docs/_examples/cb-ts-to-js/js/app/heroes-bindings.component.js
+++ /dev/null
@@ -1,39 +0,0 @@
-(function(app) {
-
- // #docregion
- var HeroesComponent = ng.core.Component({
- selector: 'heroes-bindings',
- template: '' +
- 'Tour of Heroes' +
- '
',
- host: {
- '[title]': 'title',
- '[class.heading]': 'hClass',
- '(click)': 'clicked()',
- '(dblclick)': 'doubleClicked($event)'
- }
- }).Class({
- constructor: function() {
- this.title = 'Tooltip content';
- this.hClass = true;
- },
- clicked: function() {
- this.active = !this.active;
- },
- doubleClicked: function(evt) {
- this.active = true;
- }
- });
- // #enddocregion
-
- app.HeroesHostBindingsModule =
- ng.core.NgModule({
- imports: [ ng.platformBrowser.BrowserModule ],
- declarations: [ HeroesComponent ],
- bootstrap: [ HeroesComponent ]
- })
- .Class({
- constructor: function() {}
- });
-
-})(window.app = window.app || {});
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/heroes-queries.component.js b/public/docs/_examples/cb-ts-to-js/js/app/heroes-queries.component.js
deleted file mode 100644
index f1bda77cb1..0000000000
--- a/public/docs/_examples/cb-ts-to-js/js/app/heroes-queries.component.js
+++ /dev/null
@@ -1,82 +0,0 @@
-(function(app) {
-
- var ActiveLabelComponent = ng.core.Component({
- selector: 'active-label',
- template: '' +
- 'Active' +
- ''
- }).Class({
- constructor: [function() { }],
- activate: function() {
- this.active = true;
- }
- });
-
- // #docregion content
- var HeroComponent = ng.core.Component({
- selector: 'a-hero',
- template: '' +
- '{{hero.name}} ' +
- '' +
- '
',
- inputs: ['hero'],
- queries: {
- label: new ng.core.ContentChild(
- ActiveLabelComponent)
- }
- }).Class({
- constructor: [function() { }],
- activate: function() {
- this.active = true;
- this.label.activate();
- }
- });
- app.HeroQueriesComponent = HeroComponent;
- // #enddocregion content
-
- // #docregion view
- var AppComponent = ng.core.Component({
- selector: 'heroes-queries',
- template:
- '' +
- '' +
- '' +
- '',
- queries: {
- heroCmps: new ng.core.ViewChildren(
- HeroComponent)
- }
- }).Class({
- constructor: function() {
- this.heroData = [
- {id: 1, name: 'Windstorm'},
- {id: 2, name: 'Superman'}
- ];
- },
- activate: function() {
- this.heroCmps.forEach(function(cmp) {
- cmp.activate();
- });
- }
- });
- // #enddocregion view
-
- app.HeroesQueriesModule =
- ng.core.NgModule({
- imports: [ ng.platformBrowser.BrowserModule ],
- declarations: [
- AppComponent,
- HeroComponent,
- ActiveLabelComponent
- ],
- bootstrap: [ AppComponent ]
- })
- .Class({
- constructor: function() {}
- });
-
-})(window.app = window.app || {});
diff --git a/public/docs/_examples/cb-ts-to-js/js/app/main.js b/public/docs/_examples/cb-ts-to-js/js/app/main.js
index 9091452599..fd3e737c9e 100644
--- a/public/docs/_examples/cb-ts-to-js/js/app/main.js
+++ b/public/docs/_examples/cb-ts-to-js/js/app/main.js
@@ -1,35 +1,9 @@
-// #docplaster
-// #docregion appimport
(function(app) {
- // #enddocregion appimport
- // #docregion ng2import
- var platformBrowserDynamic =
- ng.platformBrowserDynamic.platformBrowserDynamic;
- var LocationStrategy =
- ng.common.LocationStrategy;
- var HashLocationStrategy =
- ng.common.HashLocationStrategy;
- // #enddocregion ng2import
+var platformBrowserDynamic = ng.platformBrowserDynamic.platformBrowserDynamic;
- // #docregion appimport
- var HeroComponent = app.HeroComponent;
- // #enddocregion appimport
+document.addEventListener('DOMContentLoaded', function() {
+ platformBrowserDynamic().bootstrapModule(app.AppModule);
+});
- document.addEventListener('DOMContentLoaded', function() {
- platformBrowserDynamic().bootstrapModule(app.HeroesModule);
- platformBrowserDynamic().bootstrapModule(app.HeroesDslModule);
- platformBrowserDynamic().bootstrapModule(app.HeroesLifecycleModule);
- platformBrowserDynamic().bootstrapModule(app.HeroesDIModule);
- platformBrowserDynamic().bootstrapModule(app.HeroDIInlineModule);
- platformBrowserDynamic().bootstrapModule(app.HeroesDIInjectModule);
- platformBrowserDynamic().bootstrapModule(app.HeroesDIInjectModule2);
- platformBrowserDynamic().bootstrapModule(app.HeroesDIInjectAdditionalModule);
- platformBrowserDynamic().bootstrapModule(app.HeroesIOModule);
- platformBrowserDynamic().bootstrapModule(app.HeroesHostBindingsModule);
- platformBrowserDynamic().bootstrapModule(app.HeroesQueriesModule);
- });
-
- // #docregion appimport
})(window.app = window.app || {});
-// #enddocregion appimport
diff --git a/public/docs/_examples/cb-ts-to-js/js/index.html b/public/docs/_examples/cb-ts-to-js/js/index.html
index 448c295609..7d2105bf78 100644
--- a/public/docs/_examples/cb-ts-to-js/js/index.html
+++ b/public/docs/_examples/cb-ts-to-js/js/index.html
@@ -4,64 +4,41 @@
+ TypeScript to JavaScript
+
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
-
- TypeScript to JavaScript
- Classes and Class Metadata
- Input and Output Metadata
- Dependency Injection
- Host and Query Metadata
-
-
-
- Loading hero-view...
- Loading hero-view2...
- Loading hero-lifecycle...
-
-
-
- Loading hero-io...
-
-
- Dependency Injection
- Loading hero-di...
- Loading hero-di-inline...
- Loading hero-di-inline2...
- Loading hero-di-inject...
- Loading hero-di-inject-additional...
-
-
-
- Loading heroes-bindings...
- Loading heroes-queries...
+ Loading...