Merge remote-tracking branch 'remotes/angular.io/master'

# Conflicts:
#	README.md
#	harp.json
#	public/_includes/_hero-home.jade
#	public/docs/_examples/quickstart/ts/systemjs.config.1.js
#	public/docs/dart/latest/_util-fns.jade
#	public/docs/dart/latest/api/_data.json
#	public/docs/dart/latest/api/index.jade
#	public/docs/ts/latest/_data.json
#	public/docs/ts/latest/cookbook/aot-compiler.jade
#	public/docs/ts/latest/cookbook/component-communication.jade
#	public/docs/ts/latest/cookbook/visual-studio-2015.jade
#	public/docs/ts/latest/glossary.jade
#	public/docs/ts/latest/guide/_data.json
#	public/docs/ts/latest/guide/animations.jade
#	public/docs/ts/latest/guide/change-log.jade
#	public/docs/ts/latest/guide/npm-packages.jade
#	public/docs/ts/latest/guide/router.jade
#	public/docs/ts/latest/guide/security.jade
#	public/docs/ts/latest/guide/server-communication.jade
#	public/docs/ts/latest/guide/template-syntax.jade
#	public/docs/ts/latest/guide/testing.jade
#	public/docs/ts/latest/guide/typescript-configuration.jade
#	public/docs/ts/latest/guide/upgrade.jade
#	public/docs/ts/latest/guide/webpack.jade
#	public/docs/ts/latest/quickstart.jade
#	public/docs/ts/latest/tutorial/toh-pt3.jade
#	public/docs/ts/latest/tutorial/toh-pt5.jade

Server Communication and Visual studio 2015 require further merging.
This commit is contained in:
Zhimin YE 2016-11-03 15:38:23 +00:00
commit 4578087fa5
143 changed files with 1019 additions and 734 deletions

View File

@ -5,7 +5,6 @@ root = true
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

1
.gitignore vendored
View File

@ -2,7 +2,6 @@ node_modules
_temp
bower_components
jspm_packages
typings
**/packages
build
pubspec.lock

View File

@ -10,8 +10,7 @@ env:
- DBUS_SESSION_BUS_ADDRESS=/dev/null
- DISPLAY=:99.0
- CHROME_BIN=chromium-browser
# using SHA instead of version to fix build-compile issue
- LATEST_RELEASE=2.1.0
- LATEST_RELEASE=2.1.1
- TASK_FLAGS="--dgeni-log=warn"
matrix:
- TASK=lint

View File

@ -85,7 +85,7 @@ var _apiShredOptionsForDart = {
logLevel: _dgeniLogLevel
};
var _excludePatterns = ['**/node_modules/**', '**/typings/**', '**/packages/**'];
var _excludePatterns = ['**/node_modules/**', '**/packages/**'];
var _excludeMatchers = _excludePatterns.map(function(excludePattern){
return new Minimatch(excludePattern)
@ -364,11 +364,13 @@ function runProtractorAoT(appDir, outputFile) {
// fileName; then shut down the example. All protractor output is appended
// to the outputFile.
function runE2eDartTests(appDir, outputFile) {
var deployDir = path.resolve(path.join(appDir, 'build/web'));
// Launch http server out of ts directory because all the config files are there.
var httpLaunchDir = path.resolve(appDir, '../ts');
var deployDir = path.resolve(appDir, 'build/web');
gutil.log('AppDir for Dart e2e: ' + appDir);
gutil.log('Deploying from: ' + deployDir);
var appRunSpawnInfo = spawnExt('npm', ['run', 'http-server:e2e', '--', deployDir, '-s'], { cwd: EXAMPLES_PATH });
var appRunSpawnInfo = spawnExt('npm', ['run', 'http-server:e2e', '--', deployDir, '-s'], { cwd: httpLaunchDir });
if (!appRunSpawnInfo.proc.pid) {
gutil.log('http-server failed to launch over ' + deployDir);
return false;
@ -461,13 +463,6 @@ gulp.task('add-example-boilerplate', function(done) {
fsUtils.addSymlink(realPath, linkPath);
});
realPath = path.join(EXAMPLES_PATH, '/typings');
var typingsPaths = excludeDartPaths(getTypingsPaths(EXAMPLES_PATH));
typingsPaths.forEach(function(linkPath) {
gutil.log("symlinking " + linkPath + ' -> ' + realPath)
fsUtils.addSymlink(realPath, linkPath);
});
return buildStyles(copyExampleBoilerplate, done);
});
@ -530,11 +525,6 @@ gulp.task('remove-example-boilerplate', function() {
fsUtils.removeSymlink(linkPath);
});
var typingsPaths = getTypingsPaths(EXAMPLES_PATH);
typingsPaths.forEach(function(linkPath) {
fsUtils.removeSymlink(linkPath);
});
deleteExampleBoilerPlate();
});
@ -818,7 +808,7 @@ gulp.task('_harp-compile', function() {
gulp.task('_shred-devguide-examples', ['_shred-clean-devguide', '_copy-example-boilerplate'], function() {
// Split big shredding task into partials 2016-06-14
var examplePaths = globby.sync(EXAMPLES_PATH+'/*/', {ignore: ['/node_modules', 'typings/']});
var examplePaths = globby.sync(EXAMPLES_PATH+'/*/', {ignore: ['/node_modules']});
var promise = Promise.resolve(true);
examplePaths.forEach(function (examplePath) {
promise = promise.then(() => docShredder.shredSingleExampleDir(_devguideShredOptions, examplePath));
@ -877,8 +867,6 @@ gulp.task('lint', function() {
'!./public/docs/_examples/**/ts-snippets/*.ts',
'!./public/docs/_examples/style-guide/ts/**/*.avoid.ts',
'!./public/docs/_examples/**/node_modules/**/*',
'!./public/docs/_examples/**/typings/**/*',
'!./public/docs/_examples/**/typings-ng1/**/*',
'!./public/docs/_examples/**/build/**/*',
// temporary until codelyzer is fixed mgechev/codelyzer#60
'!./public/docs/_examples/animations/ts/app/hero.service.ts'
@ -1140,13 +1128,6 @@ function getNodeModulesPaths(basePath) {
return paths;
}
function getTypingsPaths(basePath) {
var paths = getExamplePaths(basePath).map(function(examplePath) {
return path.join(examplePath, "/typings");
});
return paths;
}
function getExamplePaths(basePath, includeBase) {
// includeBase defaults to false
return getPaths(basePath, _exampleConfigFilename, includeBase);
@ -1285,7 +1266,7 @@ function devGuideExamplesWatch(shredOptions, postShredAction, focus) {
// removed this version because gulp.watch has the same glob issue that dgeni has.
// var excludePattern = '!' + path.join(shredOptions.examplesDir, '**/node_modules/**/*.*');
// gulp.watch([includePattern, excludePattern], {readDelay: 500}, function (event, done) {
var ignoreThese = [ '**/node_modules/**', '**/_fragments/**', '**/dist/**', '**/typings/**',
var ignoreThese = [ '**/node_modules/**', '**/_fragments/**', '**/dist/**',
'**/dart/.pub/**', '**/dart/build/**', '**/dart/packages/**'];
ignoreThese = ignoreThese.concat(_exampleBoilerplateFiles.map((file) => `public/docs/_examples/*/*/${file}`));
var files = globby.sync( [includePattern], { ignore: ignoreThese });
@ -1385,14 +1366,14 @@ function buildApiDocsForDart() {
dabInfo.ngDartDocPath = path.join(ngPathFor('dart'), relDartDocApiDir);
// Exclude API entries for developer/internal libraries. Also exclude entries for
// the top-level catch all "angular2" library (otherwise every entry appears twice).
dabInfo.excludeLibRegExp = new RegExp(/^(?!angular2)|\.testing|_|codegen|^angular2$/);
dabInfo.excludeLibRegExp = new RegExp(/^(?!angular2)|testing|_|codegen|^angular2$/);
try {
checkAngularProjectPath(ngPathFor('dart'));
var destPath = dabInfo.ngIoDartApiDocPath;
var sourceDirs = fs.readdirSync(dabInfo.ngDartDocPath)
.filter((name) => !name.match(/^index/))
.map((name) => path.join(dabInfo.ngDartDocPath, name));
.filter(name => !name.match(/^index|^(?!angular2)|testing|codegen/))
.map(name => path.join(dabInfo.ngDartDocPath, name));
log.info(`Building Dart API pages for ${sourceDirs.length} libraries`);
return copyFiles(sourceDirs, [destPath]).then(() => {
@ -1402,7 +1383,6 @@ function buildApiDocsForDart() {
const tmpDocsPath = path.resolve(path.join(process.env.HOME, 'tmp/docs.json'));
if (argv.dumpDocsJson) fs.writeFileSync(tmpDocsPath, JSON.stringify(apiEntries, null, 2));
dab.createApiDataAndJadeFiles(apiEntries);
}).catch((err) => {
console.error(err);
});

View File

@ -7,7 +7,6 @@
"jsLatest": "2.0.0-beta.02",
"dartLatest": "2.0.0-beta.02",
"jade2ng": false,
"bios": {
"misko": {
"name": "Miško Hevery",

View File

@ -7,6 +7,6 @@ header(class="background-sky l-relative")
announcement-bar
.announcement-bar-slide.clearfix
img(src="/resources/images/logos/anglebrackets/anglebrackets.png" width="64")
p 参加10.25~10.28<strong>拉斯维加斯召开的Anglebrackets大会!</strong>
a(href="https://anglebrackets.org/#!/" target="_blank" class="button md-button") 立即注册
img(src="/resources/images/logos/anglebrackets/devintersection.png" width="64")
p 参加11月14-16号的<strong>DEVintersection Amsterdam</strong>!
a(href="https://www.devintersectioneurope.com/#!/" target="_blank" class="button md-button") Register now

View File

@ -1,23 +1,33 @@
doctype html public
html(lang="en" ng-app="angularIOApp" itemscope itemtype="http://schema.org/Framework")
head
!= partial("/_includes/_head-include")
if jade2ng
if hero == 'home'
!= partial("/_includes/_hero-home")
else
!= partial("/_includes/_hero")
!= partial("../_includes/_banner")
- var format = autoformat ? 'docs-content' : ''
article(class="l-content #{format}")
!= yield
else
doctype html public
html(lang="en" ng-app="angularIOApp" itemscope itemtype="http://schema.org/Framework")
head
!= partial("/_includes/_head-include")
body.ng-cloak.l-offset-nav(ng-controller="AppCtrl as appCtrl")
!= partial("/_includes/_main-nav")
body.ng-cloak.l-offset-nav(ng-controller="AppCtrl as appCtrl")
!= partial("/_includes/_main-nav")
<!-- HERO LOGO -->
if hero == 'home'
!= partial("/_includes/_hero-home")
else
!= partial("/_includes/_hero")
<!-- HERO LOGO -->
if hero == 'home'
!= partial("/_includes/_hero-home")
else
!= partial("/_includes/_hero")
- var format = autoformat ? 'docs-content' : ''
- var format = autoformat ? 'docs-content' : ''
article(class="l-content #{format}")
!= yield
article(class="l-content #{format}")
!= yield
!= partial("/_includes/_footer")
!= partial("/_includes/_scripts-include")
!= partial("/_includes/_scripts-minimum")
!= partial("/_includes/_footer")
!= partial("/_includes/_scripts-include")
!= partial("/_includes/_scripts-minimum")

View File

@ -7,7 +7,6 @@ package.json
systemjs.config.js
tsconfig.json
tslint.json
typings.json
wallaby.js
_test-output

View File

@ -10,7 +10,6 @@
"http-server:cli": "http-server dist/",
"lite": "lite-server",
"lite:aot": "lite-server -c aot/bs-config.json",
"postinstall": "typings install",
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
"tsc": "tsc",
"tsc:w": "tsc -w",

View File

@ -26,7 +26,7 @@
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
@ -36,10 +36,6 @@
},
rxjs: {
defaultExtension: 'js'
},
'angular-in-memory-web-api': {
main: './index.js',
defaultExtension: 'js'
}
}
});

View File

@ -51,9 +51,9 @@
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'ts': 'npm:plugin-typescript@4.0.10/lib/plugin.js',
'typescript': 'npm:typescript@2.0.2/lib/typescript.js',
'typescript': 'npm:typescript@2.0.3/lib/typescript.js',
},
// packages tells the System loader how to load when no filename and/or no extension
@ -64,10 +64,6 @@
},
rxjs: {
defaultExtension: 'js'
},
'angular-in-memory-web-api': {
main: './index.js',
defaultExtension: 'js'
}
}
});

View File

@ -38,9 +38,9 @@
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'ts': 'npm:plugin-typescript@4.0.10/lib/plugin.js',
'typescript': 'npm:typescript@2.0.2/lib/typescript.js',
'typescript': 'npm:typescript@2.0.3/lib/typescript.js',
},
// packages tells the System loader how to load when no filename and/or no extension
@ -51,10 +51,6 @@
},
rxjs: {
defaultExtension: 'js'
},
'angular-in-memory-web-api': {
main: './index.js',
defaultExtension: 'js'
}
}
});

View File

@ -9,8 +9,11 @@
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"types": []
"typeRoots": [
"../../node_modules/@types/"
]
},
"compileOnSave": true,
"exclude": [
"node_modules/*",
"**/*-aot.ts"

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -8,14 +8,12 @@
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"types": []
"suppressImplicitAnyIndexErrors": true
},
"files": [
"app/app.module.ts",
"app/main.ts",
"./typings/index.d.ts"
"app/main.ts"
],
"angularCompilerOptions": {

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="forms.css">

View File

@ -8,7 +8,10 @@
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"node_modules/@types"
]
},
"compileOnSave": true
}

View File

@ -18,7 +18,6 @@
/libpeerconnection.log
npm-debug.log
testem.log
/typings
# e2e
/e2e/*.js

View File

@ -1 +0,0 @@
/// <reference path="../typings/index.d.ts" />

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- #docregion bootstrap -->
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css">
<!-- #enddocregion bootstrap -->
<!-- #docregion styles -->
<link rel="stylesheet" href="styles.css">

View File

@ -8,7 +8,7 @@
<!-- #docregion bootstrap -->
<link rel="stylesheet"
href="node_modules/bootstrap/dist/css/bootstrap.min.css">
href="https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css">
<!-- #enddocregion bootstrap -->
<!-- #docregion styles -->
<link rel="stylesheet" href="styles.css">

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -13,7 +13,7 @@
<script src="https://unpkg.com/zone.js@0.6.25"></script>
<script src="https://unpkg.com/reflect-metadata@0.1.8"></script>
<script src="https://unpkg.com/systemjs@0.19.27/dist/system.src.js"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
<script src="https://unpkg.com/typescript@2.0.3/lib/typescript.js"></script>
<!-- 2. Configure SystemJS -->

View File

@ -14,7 +14,7 @@
<script src="https://unpkg.com/zone.js@0.6.25"></script>
<script src="https://unpkg.com/reflect-metadata@0.1.8"></script>
<script src="https://unpkg.com/systemjs@0.19.27/dist/system.src.js"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
<script src="https://unpkg.com/typescript@2.0.3/lib/typescript.js"></script>
<!-- 2. Configure SystemJS -->

View File

@ -5,7 +5,7 @@
<title>Angular Tabs</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="styles.css">
<!-- Polyfill(s) for older browsers -->

View File

@ -5,7 +5,7 @@
<title>Angular Todos</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="styles.css">
<!-- Polyfill(s) for older browsers -->

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -3,8 +3,6 @@
"version": "1.0.0",
"description": "Master package.json, the superset of all dependencies for all of the _example package.json files. See _boilerplate/package.json for example npm scripts.",
"scripts": {
"postinstall": "typings install",
"typings": "typings",
"protractor": "protractor",
"webdriver:update": "webdriver-manager update"
},
@ -17,22 +15,20 @@
}
],
"dependencies": {
"@angular/common": "~2.1.0",
"@angular/compiler": "~2.1.0",
"@angular/compiler-cli": "~2.1.0",
"@angular/core": "~2.1.0",
"@angular/forms": "~2.1.0",
"@angular/http": "~2.1.0",
"@angular/platform-browser": "~2.1.0",
"@angular/platform-browser-dynamic": "~2.1.0",
"@angular/platform-server": "~2.1.0",
"@angular/router": "~3.1.0",
"@angular/upgrade": "~2.1.0",
"@angular/common": "~2.1.1",
"@angular/compiler": "~2.1.1",
"@angular/compiler-cli": "~2.1.1",
"@angular/core": "~2.1.1",
"@angular/forms": "~2.1.1",
"@angular/http": "~2.1.1",
"@angular/platform-browser": "~2.1.1",
"@angular/platform-browser-dynamic": "~2.1.1",
"@angular/platform-server": "~2.1.1",
"@angular/router": "~3.1.1",
"@angular/upgrade": "~2.1.1",
"angular-in-memory-web-api": "~0.1.5",
"bootstrap": "^3.3.7",
"angular-in-memory-web-api": "~0.1.13",
"core-js": "^2.4.1",
"protractor": "^4.0.9",
"reflect-metadata": "^0.1.8",
"rollup": "^0.36.0",
"rollup-plugin-node-resolve": "^2.0.0",
@ -42,8 +38,16 @@
"zone.js": "^0.6.25"
},
"devDependencies": {
"@types/angular": "^1.5.15",
"@types/jasmine": "^2.2.34",
"@types/angular": "^1.5.16",
"@types/angular-animate": "^1.5.5",
"@types/angular-cookies": "^1.4.2",
"@types/angular-mocks": "^1.5.5",
"@types/angular-resource": "^1.5.6",
"@types/angular-route": "^1.3.2",
"@types/angular-sanitize": "^1.3.3",
"@types/core-js": "^0.9.34",
"@types/jasmine": "~2.5.36",
"@types/node": "^6.0.45",
"@types/selenium-webdriver": "^2.53.32",
"angular2-template-loader": "^0.4.0",
"awesome-typescript-loader": "^2.2.4",
@ -55,8 +59,8 @@
"html-loader": "^0.4.3",
"html-webpack-plugin": "^2.16.1",
"http-server": "^0.9.0",
"jasmine": "^2.5.2",
"jasmine-core": "^2.5.2",
"jasmine": "~2.4.1",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
@ -70,17 +74,16 @@
"lodash": "^4.16.2",
"null-loader": "^0.1.1",
"phantomjs-prebuilt": "^2.1.7",
"protractor": "^4.0.9",
"protractor": "4.0.9",
"raw-loader": "^0.5.1",
"rimraf": "^2.5.4",
"rollup-plugin-commonjs": "^4.1.0",
"source-map-explorer": "^1.3.2",
"style-loader": "^0.13.1",
"ts-loader": "^0.8.2",
"ts-node": "^1.3.0",
"tslint": "^3.15.1",
"typescript": "^2.0.3",
"typings": "^1.4.0",
"webdriver-manager": "10.2.5",
"webpack": "^1.13.0",
"webpack-dev-server": "^1.14.1",
"webpack-merge": "^0.14.0"

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -5,7 +5,8 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
dev_dependencies:
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -12,18 +12,17 @@
}
],
"dependencies": {
"@angular/common": "~2.1.0",
"@angular/compiler": "~2.1.0",
"@angular/core": "~2.1.0",
"@angular/forms": "~2.1.0",
"@angular/http": "~2.1.0",
"@angular/platform-browser": "~2.1.0",
"@angular/platform-browser-dynamic": "~2.1.0",
"@angular/router": "~3.1.0",
"@angular/upgrade": "~2.1.0",
"@angular/common": "~2.1.1",
"@angular/compiler": "~2.1.1",
"@angular/core": "~2.1.1",
"@angular/forms": "~2.1.1",
"@angular/http": "~2.1.1",
"@angular/platform-browser": "~2.1.1",
"@angular/platform-browser-dynamic": "~2.1.1",
"@angular/router": "~3.1.1",
"@angular/upgrade": "~2.1.1",
"angular-in-memory-web-api": "~0.1.5",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12",

View File

@ -4,10 +4,8 @@
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
"tsc:w": "tsc -w"
},
"licenses": [
{
@ -16,18 +14,17 @@
}
],
"dependencies": {
"@angular/common": "~2.1.0",
"@angular/compiler": "~2.1.0",
"@angular/core": "~2.1.0",
"@angular/forms": "~2.1.0",
"@angular/http": "~2.1.0",
"@angular/platform-browser": "~2.1.0",
"@angular/platform-browser-dynamic": "~2.1.0",
"@angular/router": "~3.1.0",
"@angular/upgrade": "~2.1.0",
"@angular/common": "~2.1.1",
"@angular/compiler": "~2.1.1",
"@angular/core": "~2.1.1",
"@angular/forms": "~2.1.1",
"@angular/http": "~2.1.1",
"@angular/platform-browser": "~2.1.1",
"@angular/platform-browser-dynamic": "~2.1.1",
"@angular/router": "~3.1.1",
"@angular/upgrade": "~2.1.1",
"angular-in-memory-web-api": "~0.1.5",
"bootstrap": "^3.3.7",
"angular-in-memory-web-api": "~0.1.13",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12",
@ -35,9 +32,10 @@
"zone.js": "^0.6.25"
},
"devDependencies": {
"@types/core-js": "^0.9.34",
"@types/node": "^6.0.45",
"concurrently": "^3.0.0",
"lite-server": "^2.2.2",
"typescript": "^2.0.3",
"typings":"^1.4.0"
"typescript": "^2.0.3"
}
}

View File

@ -23,10 +23,11 @@
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {

View File

@ -1,7 +0,0 @@
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160725163759",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160909174046"
}
}

View File

@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
@ -27,7 +27,10 @@ describe('Router', function () {
heroDetailTitle: element(by.css('my-app > ng-component > div > h3')),
adminHref: hrefEles.get(2),
loginHref: hrefEles.get(3)
adminPreloadList: element.all(by.css('my-app > ng-component > ng-component > ul > li')),
loginHref: hrefEles.get(3),
loginButton: element.all(by.css('my-app > ng-component > p > button')),
};
}
@ -105,6 +108,16 @@ describe('Router', function () {
});
});
it('should be able to see the preloaded modules', function () {
let page = getPageStruct();
page.loginHref.click().then(function() {
return page.loginButton.click();
}).then(function() {
expect(page.adminPreloadList.count()).toBe(1, 'should be 1 preloaded module');
expect(page.adminPreloadList.first().getText()).toBe('crisis-center', 'first preload should be crisis center');
});
});
function crisisCenterEdit(index: number, shouldSave: boolean) {
let page = getPageStruct();
let crisisEle: ElementFinder;

View File

@ -0,0 +1,33 @@
// #docregion
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
@Component({
template: `
<p>Dashboard</p>
<p>Session ID: {{ sessionId | async }}</p>
<a id="anchor"></a>
<p>Token: {{ token | async }}</p>
`
})
export class AdminDashboardComponent implements OnInit {
sessionId: Observable<string>;
token: Observable<string>;
constructor(private route: ActivatedRoute) {}
ngOnInit() {
// Capture the session ID if available
this.sessionId = this.route
.queryParams
.map(params => params['session_id'] || 'None');
// Capture the fragment if available
this.token = this.route
.fragment
.map(fragment => fragment || 'None');
}
}

View File

@ -1,7 +1,9 @@
// #docregion
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import { PreloadSelectedModules } from '../selective-preload-strategy';
import 'rxjs/add/operator/map';
@Component({
@ -11,13 +13,24 @@ import 'rxjs/add/operator/map';
<p>Session ID: {{ sessionId | async }}</p>
<a id="anchor"></a>
<p>Token: {{ token | async }}</p>
Preloaded Modules
<ul>
<li *ngFor="let module of modules">{{ module }}</li>
</ul>
`
})
export class AdminDashboardComponent implements OnInit {
sessionId: Observable<string>;
token: Observable<string>;
modules: string[];
constructor(private route: ActivatedRoute) {}
constructor(
private route: ActivatedRoute,
private preloadStrategy: PreloadSelectedModules
) {
this.modules = preloadStrategy.preloadedModules;
}
ngOnInit() {
// Capture the session ID if available

View File

@ -0,0 +1,33 @@
// #docplaster
// #docregion
import { NgModule } from '@angular/core';
// #docregion import-router
import { RouterModule } from '@angular/router';
// #enddocregion import-router
import { CanDeactivateGuard } from './can-deactivate-guard.service';
// #docregion can-load-guard
import { AuthGuard } from './auth-guard.service';
// #enddocregion can-load-guard
// #docregion lazy-load-admin, can-load-guard
@NgModule({
imports: [
RouterModule.forRoot([
{
path: 'admin',
loadChildren: 'app/admin/admin.module#AdminModule',
// #enddocregion lazy-load-admin
canLoad: [AuthGuard]
// #docregion lazy-load-admin
}
])
],
exports: [
RouterModule
],
providers: [
CanDeactivateGuard
]
})
export class AppRoutingModule {}

View File

@ -0,0 +1,44 @@
// #docplaster
// #docregion, preload-v1
import { NgModule } from '@angular/core';
import {
RouterModule,
// #enddocregion preload-v1
PreloadAllModules
// #docregion preload-v1
} from '@angular/router';
import { CanDeactivateGuard } from './can-deactivate-guard.service';
import { AuthGuard } from './auth-guard.service';
@NgModule({
imports: [
RouterModule.forRoot([
{
path: 'admin',
loadChildren: 'app/admin/admin.module#AdminModule',
canLoad: [AuthGuard]
},
{
path: '',
redirectTo: '/heroes',
pathMatch: 'full'
},
{
path: 'crisis-center',
loadChildren: 'app/crisis-center/crisis-center.module#CrisisCenterModule'
},
],
// #enddocregion preload-v1
{ preloadingStrategy: PreloadAllModules }
// #docregion preload-v1
)
],
exports: [
RouterModule
],
providers: [
CanDeactivateGuard
]
})
export class AppRoutingModule {}

View File

@ -1,33 +1,43 @@
// #docplaster
// #docregion
// #docregion, preload-v1
import { NgModule } from '@angular/core';
// #docregion import-router
import { RouterModule } from '@angular/router';
// #enddocregion import-router
import { CanDeactivateGuard } from './can-deactivate-guard.service';
// #docregion can-load-guard
import { AuthGuard } from './auth-guard.service';
// #enddocregion can-load-guard
import { PreloadSelectedModules } from './selective-preload-strategy';
// #docregion lazy-load-admin, can-load-guard
@NgModule({
imports: [
RouterModule.forRoot([
{
path: 'admin',
loadChildren: 'app/admin/admin.module#AdminModule',
// #enddocregion lazy-load-admin
canLoad: [AuthGuard]
// #docregion lazy-load-admin
},
{
path: '',
redirectTo: '/heroes',
pathMatch: 'full'
},
// #docregion preload-v2
{
path: 'crisis-center',
loadChildren: 'app/crisis-center/crisis-center.module#CrisisCenterModule',
data: {
preload: true
}
}
])
// #enddocregion preload-v2
],
{ preloadingStrategy: PreloadSelectedModules })
],
exports: [
RouterModule
],
providers: [
CanDeactivateGuard
CanDeactivateGuard,
PreloadSelectedModules
]
})
export class AppRoutingModule {}

View File

@ -9,6 +9,8 @@ import { AppRoutingModule } from './app-routing.module';
import { HeroesModule } from './heroes/heroes.module';
import { CrisisCenterModule } from './crisis-center/crisis-center.module';
import { LoginRoutingModule } from './login-routing.module';
import { LoginComponent } from './login.component';
import { DialogService } from './dialog.service';
@NgModule({
@ -21,7 +23,8 @@ import { DialogService } from './dialog.service';
AppRoutingModule
],
declarations: [
AppComponent
AppComponent,
LoginComponent
],
providers: [
DialogService

View File

@ -5,11 +5,9 @@ import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { LoginRoutingModule } from './login-routing.module';
import { HeroesModule } from './heroes/heroes.module';
import { CrisisCenterModule } from './crisis-center/crisis-center.module';
import { LoginRoutingModule } from './login-routing.module';
import { LoginComponent } from './login.component';
import { DialogService } from './dialog.service';
@ -19,7 +17,6 @@ import { DialogService } from './dialog.service';
BrowserModule,
FormsModule,
HeroesModule,
CrisisCenterModule,
LoginRoutingModule,
AppRoutingModule
],

View File

@ -0,0 +1,60 @@
// #docplaster
// #docregion
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { CrisisCenterHomeComponent } from './crisis-center-home.component';
import { CrisisListComponent } from './crisis-list.component';
import { CrisisCenterComponent } from './crisis-center.component';
import { CrisisDetailComponent } from './crisis-detail.component';
import { CanDeactivateGuard } from '../can-deactivate-guard.service';
// #docregion crisis-detail-resolve
import { CrisisDetailResolve } from './crisis-detail-resolve.service';
@NgModule({
imports: [
RouterModule.forChild([
// #docregion redirect
{
path: '',
redirectTo: '/crisis-center',
pathMatch: 'full'
},
// #enddocregion redirect
{
path: 'crisis-center',
component: CrisisCenterComponent,
children: [
{
path: '',
component: CrisisListComponent,
children: [
{
path: ':id',
component: CrisisDetailComponent,
canDeactivate: [CanDeactivateGuard],
resolve: {
crisis: CrisisDetailResolve
}
},
{
path: '',
component: CrisisCenterHomeComponent
}
]
}
]
}
])
],
exports: [
RouterModule
],
providers: [
CrisisDetailResolve
]
})
export class CrisisCenterRoutingModule { }
// #enddocregion

View File

@ -16,15 +16,8 @@ import { CrisisDetailResolve } from './crisis-detail-resolve.service';
@NgModule({
imports: [
RouterModule.forChild([
// #docregion redirect
{
path: '',
redirectTo: '/crisis-center',
pathMatch: 'full'
},
// #enddocregion redirect
{
path: 'crisis-center',
component: CrisisCenterComponent,
children: [
{

View File

@ -35,14 +35,14 @@ import { DialogService } from '../dialog.service';
transform: 'translateX(0)'
})
),
transition('void => *', [
transition(':enter', [
style({
opacity: 0,
transform: 'translateX(-100%)'
}),
animate('0.2s ease-in')
]),
transition('* => void', [
transition(':leave', [
animate('0.5s ease-out', style({
opacity: 0,
transform: 'translateY(100%)'

View File

@ -34,14 +34,14 @@ import { DialogService } from '../dialog.service';
transform: 'translateX(0)'
})
),
transition('void => *', [
transition(':enter', [
style({
opacity: 0,
transform: 'translateX(-100%)'
}),
animate('0.2s ease-in')
]),
transition('* => void', [
transition(':leave', [
animate('0.5s ease-out', style({
opacity: 0,
transform: 'translateY(100%)'

View File

@ -34,14 +34,14 @@ import { Hero, HeroService } from './hero.service';
transform: 'translateX(0)'
})
),
transition('void => *', [
transition(':enter', [
style({
opacity: 0,
transform: 'translateX(-100%)'
}),
animate('0.2s ease-in')
]),
transition('* => void', [
transition(':leave', [
animate('0.5s ease-out', style({
opacity: 0,
transform: 'translateY(100%)'

View File

@ -0,0 +1,24 @@
// #docregion
import 'rxjs/add/observable/of';
import { Injectable } from '@angular/core';
import { PreloadingStrategy, Route } from '@angular/router';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class PreloadSelectedModules implements PreloadingStrategy {
preloadedModules: string[] = [];
preload(route: Route, load: Function): Observable<any> {
if (route.data && route.data['preload']) {
// add the route path to our preloaded module array
this.preloadedModules.push(route.path);
// log the route path to the console
console.log('Preloaded: ' + route.path);
return load();
} else {
return Observable.of(null);
}
}
}

View File

@ -3,7 +3,7 @@
"files":[
"!**/*.d.ts",
"!**/*.js",
"!**/*.[1,2,3,4,5,6].*",
"!**/*.[0-9].*",
"!app/crisis-list.component.ts",
"!app/hero-list.component.ts",
"!app/crisis-center/add-crisis.component.ts",

View File

@ -5,12 +5,12 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
http: ^0.11.3+3
http: ^0.11.0
jsonpadding: ^0.1.0
stream_transformers: ^0.3.0+3
stream_transformers: ^0.3.0
http_in_memory_web_api: ^0.2.0
# #docregion transformers
transformers:

View File

@ -3,7 +3,7 @@
import { Component } from '@angular/core';
// #docregion import-rxjs
// Add the RxJS Observable operators we need in this app.
// Add the RxJS Observable operators.
import './rxjs-operators';
// #enddocregion import-rxjs

View File

@ -3,10 +3,10 @@ import { InMemoryDbService } from 'angular-in-memory-web-api';
export class HeroData implements InMemoryDbService {
createDb() {
let heroes = [
{ id: '1', name: 'Windstorm' },
{ id: '2', name: 'Bombasto' },
{ id: '3', name: 'Magneta' },
{ id: '4', name: 'Tornado' }
{ id: 1, name: 'Windstorm' },
{ id: 2, name: 'Bombasto' },
{ id: 3, name: 'Magneta' },
{ id: 4, name: 'Tornado' }
];
return {heroes};
}

View File

@ -1,8 +1,8 @@
{
"data": [
{ "id": "1", "name": "Windstorm" },
{ "id": "2", "name": "Bombasto" },
{ "id": "3", "name": "Magneta" },
{ "id": "4", "name": "Tornado" }
{ "id": 1, "name": "Windstorm" },
{ "id": 2, "name": "Bombasto" },
{ "id": 3, "name": "Magneta" },
{ "id": 4, "name": "Tornado" }
]
}

View File

@ -2,7 +2,7 @@
// import 'rxjs/Rx'; // adds ALL RxJS statics & operators to Observable
// See node_module/rxjs/Rxjs.js
// Import just the rxjs statics and operators we need for THIS app.
// Import just the rxjs statics and operators needed for THIS app.
// Statics
import 'rxjs/add/observable/throw';

View File

@ -2,13 +2,10 @@
<h1>Tour of Heroes ({{mode}})</h1>
<h3>Heroes:</h3>
<ul>
<li *ngFor="let hero of heroes">
{{hero.name}}
</li>
<li *ngFor="let hero of heroes">{{hero.name}}</li>
</ul>
New hero name:
<input #newHeroName />
<button (click)="addHero(newHeroName.value); newHeroName.value=''">
Add Hero
</button>
<div class="error" *ngIf="errorMessage">{{errorMessage}}</div>
<label>New hero name: <input #newHeroName /></label>
<button (click)="addHero(newHeroName.value); newHeroName.value=''">Add Hero</button>
<p class="error" *ngIf="errorMessage">{{errorMessage}}</p>

View File

@ -8,7 +8,8 @@ import { HeroService } from './hero.service.promise';
selector: 'hero-list-promise',
moduleId: module.id,
templateUrl: 'hero-list.component.html',
providers: [ HeroService ]
providers: [ HeroService ],
styles: ['.error {color:red;}']
})
// #docregion component
export class HeroListPromiseComponent implements OnInit {

View File

@ -8,7 +8,8 @@ import { HeroService } from './hero.service';
moduleId: module.id,
selector: 'hero-list',
templateUrl: 'hero-list.component.html',
providers: [ HeroService ]
providers: [ HeroService ],
styles: ['.error {color:red;}']
})
// #docregion component
export class HeroListComponent implements OnInit {

View File

@ -9,7 +9,7 @@ import { Hero } from './hero';
@Injectable()
export class HeroService {
// URL to web api
private heroesUrl = 'app/heroes.json';
private heroesUrl = 'app/heroes';
constructor (private http: Http) {}
@ -22,11 +22,10 @@ export class HeroService {
}
addHero (name: string): Promise<Hero> {
let body = JSON.stringify({ name });
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
return this.http.post(this.heroesUrl, body, options)
return this.http.post(this.heroesUrl, { name }, options)
.toPromise()
.then(this.extractData)
.catch(this.handleError);
@ -37,12 +36,17 @@ export class HeroService {
return body.data || { };
}
private handleError (error: any) {
private handleError (error: Response | any) {
// In a real world app, we might use a remote logging infrastructure
// We'd also dig deeper into the error to get a better message
let errMsg = (error.message) ? error.message :
error.status ? `${error.status} - ${error.statusText}` : 'Server error';
console.error(errMsg); // log to console instead
let errMsg: string;
if (error instanceof Response) {
const body = error.json() || '';
const err = body.error || JSON.stringify(body);
errMsg = `${error.status} - ${error.statusText || ''} ${err}`;
} else {
errMsg = error.message ? error.message : error.toString();
}
console.error(errMsg);
return Promise.reject(errMsg);
}

View File

@ -34,11 +34,10 @@ export class HeroService {
// #docregion addhero, addhero-sig
addHero (name: string): Observable<Hero> {
// #enddocregion addhero-sig
let body = JSON.stringify({ name });
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
return this.http.post(this.heroesUrl, body, options)
return this.http.post(this.heroesUrl, { name }, options)
.map(this.extractData)
.catch(this.handleError);
}
@ -50,14 +49,19 @@ export class HeroService {
return body.data || { };
}
// #enddocregion extract-data
// #docregion error-handling
private handleError (error: any) {
private handleError (error: Response | any) {
// In a real world app, we might use a remote logging infrastructure
// We'd also dig deeper into the error to get a better message
let errMsg = (error.message) ? error.message :
error.status ? `${error.status} - ${error.statusText}` : 'Server error';
console.error(errMsg); // log to console instead
let errMsg: string;
if (error instanceof Response) {
const body = error.json() || '';
const err = body.error || JSON.stringify(body);
errMsg = `${error.status} - ${error.statusText || ''} ${err}`;
} else {
errMsg = error.message ? error.message : error.toString();
}
console.error(errMsg);
return Observable.throw(errMsg);
}
// #enddocregion error-handling, methods

View File

@ -1,3 +1,5 @@
/* tslint:disable: member-ordering forin */
// #docplaster
// #docregion
import { Component } from '@angular/core';
import { Observable } from 'rxjs/Observable';
@ -8,33 +10,27 @@ import { Subject } from 'rxjs/Subject';
import { WikipediaService } from './wikipedia.service';
@Component({
moduleId: module.id,
selector: 'my-wiki-smart',
template: `
<h1>Smarter Wikipedia Demo</h1>
<p><i>Fetches when typing stops</i></p>
<input #term (keyup)="search(term.value)"/>
<ul>
<li *ngFor="let item of items | async">{{item}}</li>
</ul>
`,
providers: [WikipediaService]
templateUrl: 'wiki.component.html',
providers: [ WikipediaService ]
})
export class WikiSmartComponent {
constructor (private wikipediaService: WikipediaService) { }
title = 'Smarter Wikipedia Demo';
fetches = 'Fetches when typing stops';
items: Observable<string[]>;
// #docregion subject
private searchTermStream = new Subject<string>();
search(term: string) { this.searchTermStream.next(term); }
// #enddocregion subject
// #docregion observable-operators
items: Observable<string[]> = this.searchTermStream
.debounceTime(300)
.distinctUntilChanged()
.switchMap((term: string) => this.wikipediaService.search(term));
// #enddocregion observable-operators
constructor (private wikipediaService: WikipediaService) {
// #docregion observable-operators
this.items = this.searchTermStream
.debounceTime(300)
.distinctUntilChanged()
.switchMap((term: string) => this.wikipediaService.search(term));
// #enddocregion observable-operators
}
}

View File

@ -0,0 +1,11 @@
<!-- #docregion -->
<h1>{{title}}</h1>
<p><i>{{fetches}}</i></p>
<!-- #docregion keyup -->
<input #term (keyup)="search(term.value)"/>
<!-- #enddocregion keyup -->
<ul>
<li *ngFor="let item of items | async">{{item}}</li>
</ul>

View File

@ -5,25 +5,19 @@ import { Observable } from 'rxjs/Observable';
import { WikipediaService } from './wikipedia.service';
@Component({
moduleId: module.id,
selector: 'my-wiki',
template: `
<h1>Wikipedia Demo</h1>
<p><i>Fetches after each keystroke</i></p>
<input #term (keyup)="search(term.value)"/>
<ul>
<li *ngFor="let item of items | async">{{item}}</li>
</ul>
`,
providers: [WikipediaService]
templateUrl: 'wiki.component.html',
providers: [ WikipediaService ]
})
export class WikiComponent {
title = 'Wikipedia Demo';
fetches = 'Fetches after each keystroke';
items: Observable<string[]>;
constructor (private wikipediaService: WikipediaService) {}
search (term: string) {
this.items = this.wikipediaService.search(term);
}
constructor (private wikipediaService: WikipediaService) { }
}

View File

@ -6,8 +6,6 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="sample.css">
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>

View File

@ -1 +0,0 @@
.error {color:red;}

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -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';
@ -30,4 +30,15 @@ describe('Template Syntax', function () {
let specialButtonEle = element(by.cssContainingText('div.special~button', 'button'));
expect(specialButtonEle.getAttribute('style')).toMatch('color: red');
});
it('should two-way bind to sizer', function () {
let buttons = element.all(by.css('div#two-way-1 my-sizer button'));
let input = element(by.css('input#fontsize'));
input.getAttribute('value').then(size => {
buttons.get(1).click();
browser.waitForAngular();
expect(input.getAttribute('value')).toEqual((+size + 1).toString());
});
});
});

View File

@ -14,7 +14,7 @@
</div>
<br>
<a href="#event-binding">Event Binding</a><br>
<a href="#two-way">Two-way Binding</a><br>
<br>
<div>Directives</div>
<div style="margin-left:8px">
@ -242,9 +242,6 @@ button</button>
<button [attr.disabled]="!isUnchanged">Disabled as well</button>
<!-- can't remove it with [attr.disabled] either -->
<button disabled [attr.disabled]>Still disabled</button>
<!-- we'd have to remove it with property binding -->
<button disabled [disabled]="false">Enabled (but inert)</button>
</div>
@ -349,9 +346,26 @@ button</button>
</div>
<!-- #enddocregion event-binding-propagation -->
<br><br>
<a class="to-toc" href="#toc">top</a>
<hr><h2 id="two-way">Two-way Binding</h2>
<div id="two-way-1">
<!-- #docregion two-way-1 -->
<my-sizer [(size)]="fontSize"></my-sizer>
<div [style.font-size.px]="fontSize">Resizable Text</div>
<!-- #enddocregion two-way-1 -->
<label>FontSize: <input id="fontsize" [(ngModel)]="fontSize"></label>
</div>
<br>
<div id="two-way-2">
<h3>De-sugared two-way binding</h3>
<!-- #docregion two-way-2 -->
<my-sizer [size]="fontSize" (sizeChange)="fontSize=$event"></my-sizer>
<!-- #enddocregion two-way-2 -->
</div>
<br><br>
<a class="to-toc" href="#toc">top</a>
<!-- Two way data binding unwound;
passing the changed display value to the event handler via `$event` -->
<hr><h2 id="ngModel">NgModel (two-way) Binding</h2>

View File

@ -1,4 +1,4 @@
/* tslint:disable forin */
/* tslint:disable:forin member-ordering */
// #docplaster
import { AfterViewInit, Component, ElementRef, OnInit, QueryList, ViewChildren } from '@angular/core';
@ -50,6 +50,8 @@ export class AppComponent implements AfterViewInit, OnInit {
this.alert('Deleted hero: ' + (hero && hero.firstName));
}
fontSize = 10;
// #docregion evil-title
evilTitle = 'Template <script>alert("evil never sleeps")</script>Syntax';
// #enddocregion evil-title

View File

@ -5,6 +5,7 @@ import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { BigHeroDetailComponent, HeroDetailComponent } from './hero-detail.component';
import { MyClickDirective, MyClickDirective2 } from './my-click.directive';
import { SizerComponent } from './sizer.component';
@NgModule({
imports: [
@ -16,7 +17,8 @@ import { MyClickDirective, MyClickDirective2 } from './my-click.directive';
BigHeroDetailComponent,
HeroDetailComponent,
MyClickDirective,
MyClickDirective2
MyClickDirective2,
SizerComponent
],
bootstrap: [ AppComponent ]
})

View File

@ -0,0 +1,25 @@
// #docregion
import { Component, EventEmitter, Input, Output } from '@angular/core';
@Component({
selector: 'my-sizer',
template: `
<div>
<button (click)="dec()" title="smaller">-</button>
<button (click)="inc()" title="bigger">+</button>
<label [style.font-size.px]="size">FontSize: {{size}}px</label>
</div>`
})
export class SizerComponent {
@Input() size: number;
@Output() sizeChange = new EventEmitter<number>();
dec() { this.resize(-1); }
inc() { this.resize(+1); }
resize(delta: number) {
const size = +this.size + delta;
this.size = Math.min(40, Math.max(8, size));
this.sizeChange.emit(this.size);
}
}

View File

@ -28,7 +28,7 @@ var allSpecFiles = Object.keys(window.__karma__.files)
.filter(isBuiltFile);
System.config({
baseURL: '/base',
baseURL: 'base',
// Extend usual application package list with test folder
packages: { 'testing': { main: 'index.js', defaultExtension: 'js' } },

View File

@ -3,7 +3,7 @@ module.exports = function(config) {
var appBase = 'app/'; // transpiled app JS and map files
var appSrcBase = 'app/'; // app source TS files
var appAssets = '/base/app/'; // component assets fetched by Angular's compiler
var appAssets = 'base/app/'; // component assets fetched by Angular's compiler
var testBase = 'testing/'; // transpiled test JS and map files
var testSrcBase = 'testing/'; // test source TS files

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -28,7 +28,7 @@ import 'heroes_component.dart';
directives: const [ROUTER_DIRECTIVES],
providers: const [HeroService, ROUTER_PROVIDERS])
// #enddocregion directives-and-providers
// #docregion heroes
// #docregion heroes, routes
@RouteConfig(const [
// #enddocregion heroes
// #docregion dashboard
@ -45,7 +45,7 @@ import 'heroes_component.dart';
// #docregion heroes
const Route(path: '/heroes', name: 'Heroes', component: HeroesComponent)
])
// #enddocregion heroes
// #enddocregion heroes, routes
class AppComponent {
String title = 'Tour of Heroes';
}

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -7,7 +7,7 @@ environment:
sdk: '>=1.19.0 <2.0.0'
# #docregion additions
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
# #enddocregion additions
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1

View File

@ -6,6 +6,8 @@
<title>Angular Tour of Heroes</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<script src="shim.min.js"></script>
<script src="zone.min.js"></script>
<!-- #docregion moduleId -->

View File

@ -14,7 +14,7 @@ import { AppRoutingModule } from './app-routing.module';
// #enddocregion v1
// Imports for loading & configuring the in-memory web api
import { InMemoryWebApiModule } from 'angular-in-memory-web-api/in-memory-web-api.module';
import { InMemoryWebApiModule } from 'angular-in-memory-web-api';
import { InMemoryDataService } from './in-memory-data.service';
// #docregion v1

View File

@ -2,7 +2,8 @@
var fs = require('fs');
var resources = [
'node_modules/core-js/client/shim.min.js',
'node_modules/zone.js/dist/zone.min.js'
'node_modules/zone.js/dist/zone.min.js',
'styles.css'
];
resources.map(function(f) {
var path = f.split('/');

View File

@ -12,13 +12,10 @@ export default {
sourceMapFile: 'aot/dist/build.js.map',
format: 'iife',
plugins: [
nodeResolve({jsnext: true, module: true}),
commonjs({
include: [
'node_modules/rxjs/**',
'node_modules/angular-in-memory-web-api/**'
],
}),
uglify()
nodeResolve({jsnext: true, module: true}),
commonjs({
include: ['node_modules/rxjs/**']
}),
uglify()
]
}

View File

@ -9,13 +9,14 @@
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"types": []
"typeRoots": [
"../../node_modules/@types/"
]
},
"files": [
"app/app.module.ts",
"app/main-aot.ts",
"typings/index.d.ts"
"app/main-aot.ts"
],
"angularCompilerOptions": {

View File

@ -1,5 +1,6 @@
// #docregion import-adapter
import { UpgradeAdapter } from '@angular/upgrade';
declare var angular: any;
import { AppModule } from './app.module';
// #enddocregion import-adapter

View File

@ -1,5 +1,6 @@
// #docregion
import { Phone, PhoneData } from '../core/phone/phone.service';
declare var angular: any;
class PhoneDetailController {
phone: PhoneData;

View File

@ -1,5 +1,6 @@
// #docregion
import { Phone, PhoneData } from '../core/phone/phone.service';
declare var angular: any;
class PhoneListController {
phones: PhoneData[];

View File

@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.22
angular2: ^2.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:

View File

@ -15,7 +15,7 @@ module.exports = {
// #docregion resolve
resolve: {
extensions: ['', '.js', '.ts']
extensions: ['', '.ts', '.js']
},
// #enddocregion resolve

View File

@ -5,8 +5,7 @@
"scripts": {
"start": "webpack-dev-server --inline --progress --port 8080",
"test": "karma start",
"build": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail",
"postinstall": "typings install"
"build": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail"
},
"licenses": [
{
@ -15,19 +14,22 @@
}
],
"dependencies": {
"@angular/common": "~2.1.0",
"@angular/compiler": "~2.1.0",
"@angular/core": "~2.1.0",
"@angular/forms": "~2.1.0",
"@angular/http": "~2.1.0",
"@angular/platform-browser": "~2.1.0",
"@angular/platform-browser-dynamic": "~2.1.0",
"@angular/router": "~3.1.0",
"@angular/common": "~2.1.1",
"@angular/compiler": "~2.1.1",
"@angular/core": "~2.1.1",
"@angular/forms": "~2.1.1",
"@angular/http": "~2.1.1",
"@angular/platform-browser": "~2.1.1",
"@angular/platform-browser-dynamic": "~2.1.1",
"@angular/router": "~3.1.1",
"core-js": "^2.4.1",
"rxjs": "5.0.0-beta.12",
"zone.js": "^0.6.25"
},
"devDependencies": {
"@types/core-js": "^0.9.34",
"@types/node": "^6.0.45",
"@types/jasmine": "^2.5.35",
"angular2-template-loader": "^0.4.0",
"awesome-typescript-loader": "^2.2.4",
"css-loader": "^0.23.1",
@ -46,8 +48,7 @@
"raw-loader": "^0.5.1",
"rimraf": "^2.5.2",
"style-loader": "^0.13.1",
"typescript": "^2.0.2",
"typings": "^1.3.2",
"typescript": "^2.0.3",
"webpack": "^1.13.0",
"webpack-dev-server": "^1.14.1",
"webpack-merge": "^0.14.0"

View File

@ -1,7 +0,0 @@
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160725163759",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160909174046"
}
}

View File

@ -4,7 +4,7 @@
"title": "Angular Docs",
"subtitle": "Dart",
"menuTitle": "Docs Home",
"banner": "Angular release is <b>beta.22</b>. View the <a href='https://github.com/dart-lang/angular2/blob/master/CHANGELOG.md' target='_blank'>change log</a> to see enhancements, fixes, and breaking changes."
"banner": "AngularDart is <b>2.0</b>. View the <a href='https://github.com/dart-lang/angular2/blob/master/CHANGELOG.md' target='_blank'>change log</a> to see enhancements, fixes, and breaking changes."
},
"quickstart": {
@ -23,7 +23,7 @@
"guide": {
"icon": "list",
"title": "Developer Guides",
"title": "Guide",
"subtitle": "Dart"
},

Some files were not shown because too many files have changed in this diff Show More