diff --git a/.firebaserc b/.firebaserc new file mode 100644 index 0000000000..2ef123c5bd --- /dev/null +++ b/.firebaserc @@ -0,0 +1,6 @@ +{ + "projects": { + "live": "angular-io", + "ngdocsdev": "ngdocsdev" + } +} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index b30e5d12a1..50d2691978 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.0.0-rc.5 + - LATEST_RELEASE=2.0.0 - TASK_FLAGS="--dgeni-log=warn" matrix: - TASK=lint diff --git a/gulpfile.js b/gulpfile.js index c6a47063b8..36185cfb30 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -91,15 +91,12 @@ var _excludeMatchers = _excludePatterns.map(function(excludePattern){ var _exampleBoilerplateFiles = [ '.editorconfig', 'a2docs.css', - 'karma.conf.js', - 'karma-test-shim.js', 'package.json', 'styles.css', 'systemjs.config.js', 'tsconfig.json', 'tslint.json', - 'typings.json', - 'wallaby.js' + 'typings.json' ]; var _exampleDartWebBoilerPlateFiles = ['a2docs.css', 'styles.css']; @@ -636,7 +633,7 @@ gulp.task('build-dart-api-docs', ['_shred-api-examples', 'dartdoc'], function() // Using the --build flag will use systemjs.config.plunker.build.js (for preview builds) gulp.task('build-plunkers', ['_copy-example-boilerplate'], function() { regularPlunker.buildPlunkers(EXAMPLES_PATH, LIVE_EXAMPLES_PATH, { errFn: gutil.log, build: argv.build }); - return embeddedPlunker.buildPlunkers(EXAMPLES_PATH, LIVE_EXAMPLES_PATH, { errFn: gutil.log, build: argv.build }); + return embeddedPlunker.buildPlunkers(EXAMPLES_PATH, LIVE_EXAMPLES_PATH, { errFn: gutil.log, build: argv.build, targetSelf: argv.targetSelf }); }); gulp.task('build-dart-cheatsheet', [], function() { @@ -1044,8 +1041,10 @@ function restoreApiHtml() { const relApiDir = path.join('docs', lang, vers, 'api'); const wwwApiSubdir = path.join('www', relApiDir); const backupApiSubdir = path.join('www-backup', relApiDir); - gutil.log(`cp ${backupApiSubdir} ${wwwApiSubdir}`) - fs.copySync(backupApiSubdir, wwwApiSubdir); + if (fs.existsSync(backupApiSubdir) || argv.forceSkipApi !== true) { + gutil.log(`cp ${backupApiSubdir} ${wwwApiSubdir}`) + fs.copySync(backupApiSubdir, wwwApiSubdir); + } }); } diff --git a/harp.json b/harp.json index 16050d8e57..e1b6aa9125 100644 --- a/harp.json +++ b/harp.json @@ -391,6 +391,7 @@ "bio": "Ward is an all-around developer with JavaScript, node, and .net chops. He's a frequent conference speaker and podcaster, trainer, Google Developer Expert for Angular, Microsoft MVP, and PluralSight author. He is also president of IdeaBlade, an enterprise software consulting firm and the makers of breeze.js. He would like to get more sleep and spend more time in the mountains.", "type": "Community" }, + "johnpapa": { "name": "John Papa", "picture": "/resources/images/bios/john-papa.jpg", @@ -399,6 +400,7 @@ "bio": "John is a Google Developer Expert, Microsoft Regional Director and MVP, frequent author of courses for Pluralsight, a former technology Evangelist for Microsoft front end teams, and author of the popular Angular Style Guide. He can often be found speaking around the world at keynotes and sessions for many conferences. You can always find John at johnpapa.net or on twitter at @john_papa.", "type": "Community" }, + "martinstaffa": { "name": "Martin Staffa", "picture": "/resources/images/bios/martinstaffa.jpg", @@ -406,6 +408,7 @@ "bio": "Martin is an English major turned web developer who loves frontend stuff. He's been part of the Angular 1 team since 2014. If you can't find him roaming the Github issue queues, he's probably out with his camera somewhere.", "type": "Community" }, + "topherfangio": { "name": "Topher Fangio", "picture": "/resources/images/bios/topherfangio.jpg", @@ -414,6 +417,7 @@ "bio": "Topher loves the web and how it empowers new forms of creativity, connection and business. He is currently a core contributor on the Angular Material project and sometimes blogs about random things.", "type": "Community" }, + "filipesilva": { "name": "Filipe Silva", "picture": "/resources/images/bios/filipe-silva.jpg", @@ -422,6 +426,7 @@ "bio": "Filipe is a passion-driven developer that always strives for the most elegant solution for each problem. He is currently an author for Angular.io, a core contributor for Angular-CLI and senior front end engineer at KonnectAgain. When not busy going through PRs, you can find him scouring reddit for new dinner recipes to cook or enjoying a craft beer in Dublin.", "type": "Community" }, + "teropa": { "name": "Tero Parviainen", "picture": "/resources/images/bios/teropa.jpg", @@ -430,15 +435,17 @@ "bio": "Tero is an independent software developer and writer. He's been building web applications for his whole professional career, and has almost figured out how to do vertical centering in CSS.", "type": "Community" }, - "deborah": { + + "deborah": { "name": "Deborah Kurata", "picture": "/resources/images/bios/deborah.jpg", "twitter": "deborahkurata", "website": "http://blogs.msmvps.com/deborahk/", "bio": "Deborah is an independent software developer and author. She is author of several Pluralsight courses including: 'Angular 2: Getting Started'", "type": "Community" - }, - "jesusrodriguez": { + }, + + "jesusrodriguez": { "name": "Jesús Rodríguez", "picture": "/resources/images/bios/jesus-rodriguez.jpg", "twitter": "foxandxss", @@ -446,6 +453,7 @@ "bio": "Jesus is an open source lover, a book author and editor, and AngularUI lead developer. He is currently a core contributor to the UI Bootstrap project.", "type": "Community" }, + "torgeirhelgevold": { "name": "Torgeir Helgevold", "picture": "/resources/images/bios/torgeirhelgevold.jpg", @@ -454,6 +462,7 @@ "bio": "Torgeir (Tor) is a front-end architect with a passion for JavaScript development. He is also an author for angular.io and an active tech blogger.", "type": "Community" }, + "fatimaremtullah": { "name": "Fatima Remtullah", "picture": "/resources/images/bios/fatima.jpg", @@ -462,6 +471,7 @@ "bio": "Fatima is a Product Designer and Front-End Developer. When she is not nerding out she is probably eating an abundance of cookies.", "type": "Community" }, + "eric": { "name": "Eric Jimenez", "picture": "/resources/images/bios/eric.jpg", @@ -470,6 +480,7 @@ "bio": "Eric is a gamer, writer, and programmer.", "type": "Community" }, + "mikeryan": { "name": "Mike Ryan", "picture": "/resources/images/bios/mikeryan.jpg", @@ -477,7 +488,8 @@ "website": "https://medium.com/@MikeRyan52", "bio": "Mike Ryan is a Software Engineer at Synapse Wireless, working on solving challenging problems in the internet-of-things space. He is an advocate of reactive programming and a core contributor to the ngrx project.", "type": "Community" - }, + }, + "rex": { "name": "Rex Ye", "picture": "/resources/images/bios/rex.jpg", @@ -485,6 +497,7 @@ "bio": "Rex is a full-stack developer. He maintains the Angular.cn website with his old pal Ralph Wang and he plays a key role in bridging between the Chinese Angular community and the world-wide community. He loves playing with flashy new technologies and enjoys the challenge of mastering new skills. His biggest challenge to date is figuring out how to sooth a crying 4-month-old baby.", "type": "Community" }, + "ralph": { "name": "Ralph Wang", "picture": "/resources/images/bios/ralph.jpg", @@ -492,6 +505,7 @@ "bio": "Ralph(Zhicheng Wang) is a senior consultant at ThoughWorks and also a GDE. He is a technology enthusiast and he is a passionate advocate of “Simplicity, Professionalism and Sharing”. In his eighteen years of R&D career, he worked as tester, R&D engineer, project manager, product manager and CTO. He is looking forward to the birth of his baby.", "type": "Community" }, + "brandonroberts": { "name": "Brandon Roberts", "picture": "/resources/images/bios/brandonroberts.jpg", @@ -500,12 +514,28 @@ "bio": "Brandon is a front-end developer for a game studio developing web applications for STEM-based learning games. He is also a natural born troubleshooter who helps solve Angular issues on Github and Gitter support channels, particularly dealing with routing. He is also a member of the Angular docs team.", "type": "Community" }, + "crisbeto": { "name": "Kristiyan Kostadinov", "picture": "/resources/images/bios/crisbeto.jpg", "website": "http://crisbeto.com/", "bio": "Kristiyan is a front-end developer, passionate open-source contributor and a core team member on Angular Material.", "type": "Community" + }, + + "gkalpak": { + "name": "Georgios Kalpakas", + "picture": "/resources/images/bios/gkalpak.jpg", + "website": "https://github.com/gkalpak", + "bio": "George is a Software Engineer with a passion for chess, robotics and automating stuff. He has a strong need to know how things work (so if you already know, he'd love to have a talk with you). He has been a member of the AngularJS team since 2014. When not doing geeky stuff, he is probably trying to convince his wife and kids to apply programming principles in real life. (Or is it the other way around?)", + "type": "Community" + }, + "kapunahelewong": { + "name": "Kapunahele Wong", + "picture": "/resources/images/bios/kapunahelewong.jpg", + "website": " https://github.com/kapunahelewong", + "bio": "Kapunahele is a front-end developer at Capital One. She loves just about anything to do with JavaScript, Angular and electronics. She enjoys mapping Hawaiian star names and constellations to Western ones and loves dancing native Hawaiian hula.", + "type": "Community" } } } diff --git a/package.json b/package.json index f8ece4dacf..96040cee6b 100644 --- a/package.json +++ b/package.json @@ -36,19 +36,19 @@ "cross-spawn": "^4.0.0", "del": "^2.2.0", "dgeni": "^0.4.0", - "dgeni-packages": "^0.15.2", + "dgeni-packages": "^0.16.0", "diff": "^2.1.3", "fs-extra": "^0.30.0", "globby": "^4.0.0", "gulp": "^3.5.6", "gulp-env": "0.4.0", - "gulp-sass": "^2.3.2", "gulp-less": "^3.1.0", + "gulp-sass": "^2.3.2", "gulp-task-listing": "^1.0.1", "gulp-tslint": "^5.0.0", "gulp-util": "^3.0.6", "gulp-watch": "^4.3.4", - "harp": "0.21.0-pre.0", + "harp": "git://github.com/filipesilva/harp.git#8da8d3497ddbfcbcbadd8be63e0fd731d7310cc4", "html2jade": "^0.8.4", "indent-string": "^2.1.0", "jasmine-core": "^2.3.4", @@ -77,4 +77,4 @@ "jstransformer-marked": "^1.0.1" }, "homepage": "http://angular.io/" -} +} \ No newline at end of file diff --git a/public/_includes/_footer.jade b/public/_includes/_footer.jade index 6f52708b25..b4afb2ce7c 100644 --- a/public/_includes/_footer.jade +++ b/public/_includes/_footer.jade @@ -8,7 +8,7 @@ else - var styleguide = "/docs/ts/latest/styleguide.html" .main-footer - nav.background-blue-grey-900.grid-fluid + nav.background-midnight.grid-fluid .c3.main-footer-branding .logo-inverse-large @@ -70,13 +70,9 @@ else ul.text-body li English - footer(class="background-steel") - p - small.text-caption Powered by Google ©2010-2016. Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0. - - p - small.text-caption.translated-cn Powered by Google ©2010-2016. 代码授权协议:MIT式协议。 文档授权协议:CC BY 4.0. - a(aria-label="View Style Guide" href=styleguide title="Style Guide" class="styleguide-trigger text-snow" md-button) + 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. + a(aria-label="View Style Guide" href=styleguide title="Style Guide" class="styleguide-trigger text-snow") span.icon-favorite a(aria-label="查看风格指南" href="/docs/ts/latest/styleguide.html" title="风格指南" class="styleguide-trigger text-snow translated-cn" md-button) span.icon-favorite diff --git a/public/_includes/_hero-home.jade b/public/_includes/_hero-home.jade index bbe29a9b90..28af477476 100644 --- a/public/_includes/_hero-home.jade +++ b/public/_includes/_hero-home.jade @@ -1,14 +1,10 @@ -header(class="background-sky") - .hero.background-superhero-paper.is-large - h1.text-headline.hero-logo.translated-cn #{title} - p.translated-cn #{subtitle} +header(class="background-sky l-relative") - .hero-cta - a(href="/docs/ts/latest/quickstart.html" class="md-raised button button-large button-plain" md-button) 开始吧! - - .banner.banner-floaty - .banner-ng-annoucement - div(class="banner-text" align="center") - p 报名参加AngularConnect,九月,英国伦敦! - div(class="banner-button") - a(href="http://angularconnect.com/?utm_source=angular&utm_medium=banner&utm_campaign=angular-banner" target="_blank" class="button md-button") 立刻注册 + .hero.background-superhero-paper.is-large + img(class="hero-logo" src='/resources/images/logos/angular2/angular.svg') + h1.text-headline #{title}
#{subtitle} + a(href="/docs/ts/latest/quickstart.html" class="hero-cta md-raised button button-large button-plain" md-button) 开始吧! + .announcement-bar.shadow-2.clearfix + img(src="/resources/images/logos/angular2/angular.svg") + p Angular 2.0最终发布啦! + a(href="http://angularjs.blogspot.com/2016/09/angular2-final.html" target="_blank" class="button " + "md-button") 了解更多 diff --git a/public/_includes/_hero.jade b/public/_includes/_hero.jade index f7e9a27ae3..5624ad9cff 100644 --- a/public/_includes/_hero.jade +++ b/public/_includes/_hero.jade @@ -13,30 +13,27 @@ if current.path[4] && current.path[3] == 'api' - var textFormat = 'is-standard-case' -header(class="hero background-sky", style=fixHeroCss ? "height:auto" : "") - div(class="inner-header") - h1(class="hero-title text-display-1 translated-cn #{textFormat}") #{headerTitle} - if useBadges - span(class="badges") - if docType - span(class="status-badge"). - #{renamer(capitalize(docType))} - if stability - span(layout="row" class="status-badge") - // badge circle is filled based on stability by matching a css selector in _hero.scss - span(class="status-circle status-#{stability}") - span Stability: #{capitalize(stability)} - if security - span(class="status-badge security-risk-badge"). - Security Risk +header.hero.background-sky + h1(class="hero-title #{textFormat}") #{headerTitle} + + if useBadges + if stability + span(class="badge is-#{stability}"). + #{capitalize(stability)} + if security + span(class="badge is-deprecated"). + 安全风险 + + //CLEAR FLOAT ELEMENTS + .clear if subtitle - h2.hero-subtitle.text-subhead #{subtitle} + h2.hero-subtitle #{subtitle} + + else if docType + h2.hero-subtitle #{renamer(capitalize(docType))} + + +if current.path[3] == 'api' && current.path[1] == 'dart' + block breadcrumbs - else if current.path[3] == 'api' && current.path[1] == 'dart' - block breadcrumbs - //- Show cross-language menu for top-level API page (but not entry pages) - if ! public.docs[current.path[1]][current.path[2]][current.path[3]][current.path[4]] - != partial("_version-dropdown") - else if current.path[0] == "docs" - != partial("_version-dropdown") diff --git a/public/_includes/_main-nav.jade b/public/_includes/_main-nav.jade index 39dfd0deb7..085b7e80d2 100644 --- a/public/_includes/_main-nav.jade +++ b/public/_includes/_main-nav.jade @@ -1,9 +1,8 @@ - var language = current.path[1] || 'ts' - if (language !== 'ts' || language !== 'js' || language !== 'dart') { language = 'ts'; } -md-toolbar(class="main-nav background-regal l-pinned-top l-layer-5",scroll-y-offset-element) - nav - h1 Angular by Google +nav.main-nav.l-pinned-top.l-layer-5 + h1 Angular by Google button(class="main-nav-button main-nav-mobile-trigger l-right" aria-label="查看菜单" ng-click="appCtrl.toggleMainMenu($event)" md-button) 网站菜单 diff --git a/public/_includes/_util-fns.jade b/public/_includes/_util-fns.jade index 3e580095c3..7ccb87f237 100644 --- a/public/_includes/_util-fns.jade +++ b/public/_includes/_util-fns.jade @@ -84,14 +84,14 @@ mixin makeExample(_filePath, region, _title, stylePatterns) - var format = attributes.format || defaultFormat; - if (attributes.format === '.') format = ''; - var avoid = !!attributes.avoid; + - var avoidClass = avoid ? 'is-anti-pattern' : ''; - if (title) - if (avoid) - .example-title.avoid AVOID: #{title} - else - .example-title #{title} - code-example(language="#{language}" format="#{format}") - != styleString(frag, stylePatterns) + div(class="code-example #{avoidClass}") + if (title) + header + h4 #{title} + code-example(language="#{language}" format="#{format}") + != styleString(frag, stylePatterns) //- Like makeExample, but: (1) doesn't show line numbers. (2) If region //- is omitted and title is 'foo (r)' then region is taken as 'r'. @@ -143,17 +143,18 @@ mixin makeJson( filePath, jsonConfig, title, stylePatterns) - var json = unescapeHtml(frag); - var jsonExtract = extractJson(json, jsonConfig); - var avoid = !!attributes.avoid; + - var avoidClass = avoid ? 'is-anti-pattern' : ''; - if (title) - if (avoid) - .example-title.avoid #{title} - else - .example-title #{title} - code-example(language="#{language}" format="#{format}") - if (jsonExtract == 'ERROR') - err 错误: 无法通过配置"#{jsonConfig.toString()}"解析JSON - else - != styleString(jsonExtract, stylePatterns) + div(class="code-example #{avoidClass}") + if (title) + header + h4 #{title} + code-example(language="#{language}" format="#{format}") + if (jsonExtract == 'ERROR') + err ERROR: Unable to extract json using config: "#{jsonConfig.toString()}" + err 错误: 无法通过配置"#{jsonConfig.toString()}"解析JSON + else + != styleString(jsonExtract, stylePatterns) if !jade2ng //- Open (and close) an explanation
. See QuickStart diff --git a/public/_includes/_version-dropdown.jade b/public/_includes/_version-dropdown.jade index 91db1cc9b9..7efde1434c 100644 --- a/public/_includes/_version-dropdown.jade +++ b/public/_includes/_version-dropdown.jade @@ -35,11 +35,10 @@ else if current.path[3] //- VERSION TREE CREATOR MIXIN mixin tree(directory, urlPrefix, name, latest) - ul - for val, semvar in directory - if semvar !== '.git' && semvar !== '_data' - - var libVersion = (semvar == "latest") ? latest : semvar.replace(/\_+/gm, ".") - li #{name} #{libVersion} + for val, semvar in directory + if semvar !== '.git' && semvar !== '_data' + - var libVersion = (semvar == "latest") ? latest : semvar.replace(/\_+/gm, ".") + li #{name} #{libVersion} //- BUTTON TITLE GENERATION @@ -69,7 +68,7 @@ nav.dropdown div(class="overlay ng-hide" ng-click="appCtrl.toggleVersionMenu($event)" ng-show="appCtrl.showMenu") - div(class="dropdown-menu" ng-class="appCtrl.showMenu ? 'is-visible' : ''") + ul(class="dropdown-menu" ng-class="appCtrl.showMenu ? 'is-visible' : ''") mixin tree(public.docs.ts, "/docs/ts", "Angular 2 for TypeScript") mixin tree(public.docs.js, "/docs/js", "Angular 2 for JavaScript") //- Disable cross-language link for API entry pages (but keep for top API search page): diff --git a/public/docs/_examples/_protractor/package.json b/public/docs/_examples/_protractor/package.json index eca5cae41f..1e12742c38 100644 --- a/public/docs/_examples/_protractor/package.json +++ b/public/docs/_examples/_protractor/package.json @@ -13,7 +13,9 @@ "license": "ISC", "devDependencies": { "protractor": "^3.3.0", - "typings": "^1.0.4" + "typings": "^1.0.4", + "ts-node": "^1.3.0", + "typescript": "^2.0.2" }, "repository": {} } diff --git a/public/docs/_examples/animations/e2e-spec.ts b/public/docs/_examples/animations/e2e-spec.ts index e2e9b64b9b..9b6319db66 100644 --- a/public/docs/_examples/animations/e2e-spec.ts +++ b/public/docs/_examples/animations/e2e-spec.ts @@ -289,6 +289,19 @@ describe('Animation Tests', () => { }); }); + describe('callbacks', () => { + it('fires a callback on start and done', () => { + addActiveHero(); + browser.manage().logs().get('browser').then((logs) => { + const animationMessages = logs.filter((log) => { + return log.message.indexOf('Animation') !== -1 ? true : false; + }); + + expect(animationMessages.length).toBeGreaterThan(0); + }); + }); + }); + function addActiveHero(sleep?: number) { sleep = sleep || 500; element(by.buttonText('Add active hero')).click(); diff --git a/public/docs/_examples/animations/ts/app/hero-list-multistep.component.ts b/public/docs/_examples/animations/ts/app/hero-list-multistep.component.ts index f0f4c1b3e1..adea35047c 100644 --- a/public/docs/_examples/animations/ts/app/hero-list-multistep.component.ts +++ b/public/docs/_examples/animations/ts/app/hero-list-multistep.component.ts @@ -6,7 +6,8 @@ import { style, animate, transition, - keyframes + keyframes, + AnimationTransitionEvent } from '@angular/core'; import { Heroes } from './hero.service'; @@ -14,14 +15,18 @@ import { Heroes } from './hero.service'; @Component({ moduleId: module.id, selector: 'hero-list-multistep', + // #docregion template template: ` `, + // #enddocregion template styleUrls: ['hero-list.component.css'], /* The element here always has the state "in" when it * is present. We animate two transitions: From void @@ -54,4 +59,12 @@ import { Heroes } from './hero.service'; }) export class HeroListMultistepComponent { @Input() heroes: Heroes; + + animationStarted(event: AnimationTransitionEvent) { + console.warn('Animation started: ', event); + } + + animationDone(event: AnimationTransitionEvent) { + console.warn('Animation done: ', event); + } } diff --git a/public/docs/_examples/cb-aot-compiler/e2e-spec.ts b/public/docs/_examples/cb-aot-compiler/e2e-spec.ts new file mode 100644 index 0000000000..1f7c00704c --- /dev/null +++ b/public/docs/_examples/cb-aot-compiler/e2e-spec.ts @@ -0,0 +1,25 @@ +/// +'use strict'; +/* tslint:disable:quotemark */ +describe('AOT Compilation', function () { + + beforeAll(function () { + browser.get(''); + }); + + it('should load page and click button', function (done) { + let headingSelector = element.all(by.css('h1')).get(0); + expect(headingSelector.getText()).toEqual('My First Angular 2 App'); + + expect(element.all(by.xpath('//div[text()="Magneta"]')).get(0).isPresent()).toBe(true); + expect(element.all(by.xpath('//div[text()="Bombasto"]')).get(0).isPresent()).toBe(true); + expect(element.all(by.xpath('//div[text()="Magma"]')).get(0).isPresent()).toBe(true); + expect(element.all(by.xpath('//div[text()="Tornado"]')).get(0).isPresent()).toBe(true); + + let toggleButton = element.all(by.css('button')).get(0); + toggleButton.click().then(function() { + expect(headingSelector.isPresent()).toBe(false); + done(); + }); + }); +}); diff --git a/public/docs/_examples/cb-aot-compiler/ts/.gitignore b/public/docs/_examples/cb-aot-compiler/ts/.gitignore new file mode 100644 index 0000000000..f2e297bbd3 --- /dev/null +++ b/public/docs/_examples/cb-aot-compiler/ts/.gitignore @@ -0,0 +1,5 @@ +**/*.ngfactory.ts +**/*.metadata.json +dist +!app/tsconfig.json +!rollup.js \ No newline at end of file diff --git a/public/docs/_examples/cb-aot-compiler/ts/app/app.component.html b/public/docs/_examples/cb-aot-compiler/ts/app/app.component.html new file mode 100644 index 0000000000..c6a7babb8b --- /dev/null +++ b/public/docs/_examples/cb-aot-compiler/ts/app/app.component.html @@ -0,0 +1,7 @@ + + +

My First Angular 2 App

+ +

List of Heroes

+
{{hero}}
+ diff --git a/public/docs/_examples/cb-aot-compiler/ts/app/app.component.ts b/public/docs/_examples/cb-aot-compiler/ts/app/app.component.ts new file mode 100644 index 0000000000..8352eb83f3 --- /dev/null +++ b/public/docs/_examples/cb-aot-compiler/ts/app/app.component.ts @@ -0,0 +1,17 @@ +// #docregion +// #docregion +import { Component } from '@angular/core'; + +@Component({ + selector: 'my-app', + templateUrl: 'app.component.html' +}) +export class AppComponent { + showHeading = true; + heroes = ['Magneta', 'Bombasto', 'Magma', 'Tornado']; + + toggleHeading() { + this.showHeading = !this.showHeading; + } + +} diff --git a/public/docs/_examples/cb-aot-compiler/ts/app/app.module.ts b/public/docs/_examples/cb-aot-compiler/ts/app/app.module.ts new file mode 100644 index 0000000000..b4fc185c24 --- /dev/null +++ b/public/docs/_examples/cb-aot-compiler/ts/app/app.module.ts @@ -0,0 +1,12 @@ +// #docregion +import { NgModule } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; + +import { AppComponent } from './app.component'; + +@NgModule({ + imports: [ BrowserModule ], + declarations: [ AppComponent ], + bootstrap: [ AppComponent ] +}) +export class AppModule { } diff --git a/public/docs/_examples/cb-aot-compiler/ts/app/main-jit.ts b/public/docs/_examples/cb-aot-compiler/ts/app/main-jit.ts new file mode 100644 index 0000000000..2a7981d0c5 --- /dev/null +++ b/public/docs/_examples/cb-aot-compiler/ts/app/main-jit.ts @@ -0,0 +1,6 @@ +// #docregion +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app.module'; + +platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/public/docs/_examples/cb-aot-compiler/ts/app/main.ts b/public/docs/_examples/cb-aot-compiler/ts/app/main.ts new file mode 100644 index 0000000000..f5a9e94209 --- /dev/null +++ b/public/docs/_examples/cb-aot-compiler/ts/app/main.ts @@ -0,0 +1,6 @@ +// #docregion +import { platformBrowser } from '@angular/platform-browser'; + +import { AppModuleNgFactory } from '../aot/app/app.module.ngfactory'; + +platformBrowser().bootstrapModuleFactory(AppModuleNgFactory); diff --git a/public/docs/_examples/cb-aot-compiler/ts/example-config.json b/public/docs/_examples/cb-aot-compiler/ts/example-config.json new file mode 100644 index 0000000000..1ef73390ce --- /dev/null +++ b/public/docs/_examples/cb-aot-compiler/ts/example-config.json @@ -0,0 +1,4 @@ +{ + "build": "build:aot", + "run": "http-server:e2e" +} \ No newline at end of file diff --git a/public/docs/_examples/cb-aot-compiler/ts/index.html b/public/docs/_examples/cb-aot-compiler/ts/index.html new file mode 100644 index 0000000000..5d3d6b68c4 --- /dev/null +++ b/public/docs/_examples/cb-aot-compiler/ts/index.html @@ -0,0 +1,23 @@ + + + + + Ahead of time compilation + + + + + + + + + + + + + Loading... + + + + + diff --git a/public/docs/_examples/cb-aot-compiler/ts/rollup.js b/public/docs/_examples/cb-aot-compiler/ts/rollup.js new file mode 100644 index 0000000000..5b90e5b0ea --- /dev/null +++ b/public/docs/_examples/cb-aot-compiler/ts/rollup.js @@ -0,0 +1,25 @@ +// #docregion +import rollup from 'rollup' +import nodeResolve from 'rollup-plugin-node-resolve' +import commonjs from 'rollup-plugin-commonjs'; +import uglify from 'rollup-plugin-uglify' + +// #docregion config +export default { + entry: 'app/main.js', + dest: 'dist/build.js', // output a single application bundle + sourceMap: false, + format: 'iife', + plugins: [ + nodeResolve({jsnext: true, module: true}), + // #docregion commonjs + commonjs({ + include: 'node_modules/rxjs/**', + }), + // #enddocregion commonjs + // #docregion uglify + uglify() + // #enddocregion uglify + ] +} +// #enddocregion config \ No newline at end of file diff --git a/public/docs/_examples/testing/ts/tsconfig.1.json b/public/docs/_examples/cb-aot-compiler/ts/tsconfig-aot.json similarity index 57% rename from public/docs/_examples/testing/ts/tsconfig.1.json rename to public/docs/_examples/cb-aot-compiler/ts/tsconfig-aot.json index 062cf1bcb4..50cd4b53be 100644 --- a/public/docs/_examples/testing/ts/tsconfig.1.json +++ b/public/docs/_examples/cb-aot-compiler/ts/tsconfig-aot.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "es5", - "module": "system", + "module": "es2015", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, @@ -9,5 +9,16 @@ "removeComments": false, "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true - } + }, + + "files": [ + "app/app.module.ts", + "app/main.ts", + "./typings/index.d.ts" + ], + + "angularCompilerOptions": { + "genDir": "aot", + "skipMetadataEmit" : true + } } 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 89e80451a6..448c295609 100644 --- a/public/docs/_examples/cb-ts-to-js/js/index.html +++ b/public/docs/_examples/cb-ts-to-js/js/index.html @@ -10,7 +10,7 @@ - + diff --git a/public/docs/_examples/forms-deprecated/e2e-spec.ts.disabled b/public/docs/_examples/forms-deprecated/e2e-spec.ts.disabled deleted file mode 100644 index ab5c8321be..0000000000 --- a/public/docs/_examples/forms-deprecated/e2e-spec.ts.disabled +++ /dev/null @@ -1,64 +0,0 @@ -/// -'use strict'; -describeIf(browser.appIsTs || browser.appIsJs, 'Forms (Deprecated) Tests', function () { - - beforeEach(function () { - browser.get(''); - }); - - it('should display correct title', function () { - expect(element.all(by.css('h1')).get(0).getText()).toEqual('Hero Form'); - }); - - - it('should not display message before submit', function () { - let ele = element(by.css('h2')); - expect(ele.isDisplayed()).toBe(false); - }); - - it('should hide form after submit', function () { - let ele = element.all(by.css('h1')).get(0); - expect(ele.isDisplayed()).toBe(true); - let b = element.all(by.css('button[type=submit]')).get(0); - b.click().then(function() { - expect(ele.isDisplayed()).toBe(false); - }); - }); - - it('should display message after submit', function () { - let b = element.all(by.css('button[type=submit]')).get(0); - b.click().then(function() { - expect(element(by.css('h2')).getText()).toContain('You submitted the following'); - }); - }); - - it('should hide form after submit', function () { - let alterEgoEle = element.all(by.css('input[ngcontrol=alterEgo]')).get(0); - expect(alterEgoEle.isDisplayed()).toBe(true); - let submitButtonEle = element.all(by.css('button[type=submit]')).get(0); - submitButtonEle.click().then(function() { - expect(alterEgoEle.isDisplayed()).toBe(false); - }); - }); - - it('should reflect submitted data after submit', function () { - let test = 'testing 1 2 3'; - let newValue: string; - let alterEgoEle = element.all(by.css('input[ngcontrol=alterEgo]')).get(0); - alterEgoEle.getAttribute('value').then(function(value) { - // alterEgoEle.sendKeys(test); - sendKeys(alterEgoEle, test); - newValue = value + test; - expect(alterEgoEle.getAttribute('value')).toEqual(newValue); - }).then(function() { - let b = element.all(by.css('button[type=submit]')).get(0); - return b.click(); - }).then(function() { - let alterEgoTextEle = element(by.cssContainingText('div', 'Alter Ego')); - expect(alterEgoTextEle.isPresent()).toBe(true, 'cannot locate "Alter Ego" label'); - let divEle = element(by.cssContainingText('div', newValue)); - expect(divEle.isPresent()).toBe(true, 'cannot locate div with this text: ' + newValue); - }); - }); -}); - diff --git a/public/docs/_examples/forms-deprecated/js/app/app.component.js b/public/docs/_examples/forms-deprecated/js/app/app.component.js deleted file mode 100644 index bb6b789938..0000000000 --- a/public/docs/_examples/forms-deprecated/js/app/app.component.js +++ /dev/null @@ -1,12 +0,0 @@ -// #docregion -(function(app) { - app.AppComponent = ng.core - .Component({ - selector: 'my-app', - template: '', - directives: [app.HeroFormComponent] - }) - .Class({ - constructor: function() {} - }); -})(window.app || (window.app = {})); diff --git a/public/docs/_examples/forms-deprecated/js/app/hero-form.component.html b/public/docs/_examples/forms-deprecated/js/app/hero-form.component.html deleted file mode 100644 index fdf8e08396..0000000000 --- a/public/docs/_examples/forms-deprecated/js/app/hero-form.component.html +++ /dev/null @@ -1,195 +0,0 @@ - - -
- -
-

Hero Form

- -
- - -
- - - -
- Name is required -
- -
- -
- - -
- -
- - -
- Power is required -
-
- - - - -
-
- - -
-

You submitted the following:

-
-
Name
-
{{ model.name }}
-
-
-
Alter Ego
-
{{ model.alterEgo }}
-
-
-
Power
-
{{ model.power }}
-
-
- -
- -
- - - -
-
- - - - -
-
- - - -
- -
- -
-

Hero Form

-
-
- - -
- -
- - -
- - - -
- - -
- - - - -
-
- - - - -
- -
-

Hero Form

-
- - {{diagnostic()}} -
- - -
- -
- - -
- -
- - -
- - - - -
-
- - - -
- - - TODO: remove this: {{model.name}} - -
- - - TODO: remove this: {{model.name}} - -
-
- - - -
- - -
TODO: remove this: {{spy.className}} - -
- -
-
- Name via form.controls = {{showFormControls(heroForm)}} -
- -
diff --git a/public/docs/_examples/forms-deprecated/js/app/hero-form.component.js b/public/docs/_examples/forms-deprecated/js/app/hero-form.component.js deleted file mode 100644 index 8988231189..0000000000 --- a/public/docs/_examples/forms-deprecated/js/app/hero-form.component.js +++ /dev/null @@ -1,52 +0,0 @@ -// #docplaster -// #docregion -// #docregion first, final -(function(app) { - app.HeroFormComponent = ng.core - .Component({ - selector: 'hero-form', - templateUrl: 'app/hero-form.component.html' - }) - .Class({ - // #docregion submitted - constructor: function() { - // #enddocregion submitted - this.powers = ['Really Smart', 'Super Flexible', - 'Super Hot', 'Weather Changer' - ]; - - this.model = new app.Hero(18, 'Dr IQ', this.powers[0], - 'Chuck Overstreet'); - - // #docregion submitted - this.submitted = false; - }, - onSubmit: function() { - this.submitted = true; - }, - // #enddocregion submitted - - // #enddocregion final - // TODO: Remove this when we're done - diagnostic: function() { - return JSON.stringify(this.model); - }, - // #enddocregion first - - - //////// DO NOT SHOW IN DOCS //////// - - // Reveal in html: - // AlterEgo via form.controls = {{showFormControls(hf)}} - showFormControls: function(form) { - return form.controls['alterEgo'] && - // #docregion form-controls - form.controls['name'].value; // Dr. IQ - // #enddocregion form-controls - }, - ///////////////////////////// - - // #docregion first, final - }); - // #enddocregion first, final -})(window.app || (window.app = {})); diff --git a/public/docs/_examples/forms-deprecated/js/app/hero.js b/public/docs/_examples/forms-deprecated/js/app/hero.js deleted file mode 100644 index 9c2449c922..0000000000 --- a/public/docs/_examples/forms-deprecated/js/app/hero.js +++ /dev/null @@ -1,11 +0,0 @@ -// #docregion -(function(app) { - app.Hero = Hero; - - function Hero(id, name, power, alterEgo) { - this.id = id; - this.name = name; - this.power = power; - this.alterEgo = alterEgo; - } -})(window.app || (window.app = {})); diff --git a/public/docs/_examples/forms-deprecated/js/app/main.js b/public/docs/_examples/forms-deprecated/js/app/main.js deleted file mode 100644 index 5930bdd061..0000000000 --- a/public/docs/_examples/forms-deprecated/js/app/main.js +++ /dev/null @@ -1,6 +0,0 @@ -// #docregion -(function(app) { - document.addEventListener('DOMContentLoaded', function() { - ng.platformBrowserDynamic.bootstrap(app.AppComponent); - }); -})(window.app || (window.app = {})); diff --git a/public/docs/_examples/forms-deprecated/js/example-config.json b/public/docs/_examples/forms-deprecated/js/example-config.json deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/public/docs/_examples/forms-deprecated/js/forms.css b/public/docs/_examples/forms-deprecated/js/forms.css deleted file mode 100644 index d7e11405b1..0000000000 --- a/public/docs/_examples/forms-deprecated/js/forms.css +++ /dev/null @@ -1,9 +0,0 @@ -/* #docregion */ -.ng-valid[required] { - border-left: 5px solid #42A948; /* green */ -} - -.ng-invalid { - border-left: 5px solid #a94442; /* red */ -} -/* #enddocregion */ \ No newline at end of file diff --git a/public/docs/_examples/forms-deprecated/js/index.html b/public/docs/_examples/forms-deprecated/js/index.html deleted file mode 100644 index e15f41e4fe..0000000000 --- a/public/docs/_examples/forms-deprecated/js/index.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - Hero Form - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Loading... - - - diff --git a/public/docs/_examples/forms-deprecated/js/plnkr.json b/public/docs/_examples/forms-deprecated/js/plnkr.json deleted file mode 100644 index 0105283bd3..0000000000 --- a/public/docs/_examples/forms-deprecated/js/plnkr.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "description": "Forms", - "files":["app/**/*.js", "**/*.html", "**/*.css"] -} diff --git a/public/docs/_examples/forms-deprecated/ts/app/app.component.ts b/public/docs/_examples/forms-deprecated/ts/app/app.component.ts deleted file mode 100644 index 2dcbc8037a..0000000000 --- a/public/docs/_examples/forms-deprecated/ts/app/app.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -// #docregion -import { Component } from '@angular/core'; -import { HeroFormComponent } from './hero-form.component'; - -@Component({ - selector: 'my-app', - template: '', - directives: [HeroFormComponent] -}) -export class AppComponent { } diff --git a/public/docs/_examples/forms-deprecated/ts/app/hero-form.component.html b/public/docs/_examples/forms-deprecated/ts/app/hero-form.component.html deleted file mode 100644 index 6fcfc2a7cb..0000000000 --- a/public/docs/_examples/forms-deprecated/ts/app/hero-form.component.html +++ /dev/null @@ -1,208 +0,0 @@ - - -
- -
-

Hero Form

- -
- - -
- - - - -
- - Name is required -
- -
- -
- - -
- -
- - -
- Power is required -
-
- - - - - - - - - - - -
-
- Name via form.controls = {{showFormControls(heroForm)}} -
- - -
-
- - -
-

You submitted the following:

-
-
Name
-
{{ model.name }}
-
-
-
Alter Ego
-
{{ model.alterEgo }}
-
-
-
Power
-
{{ model.power }}
-
-
- -
- -
- - - -
-
- - - - -
-
- - - -
- -
- -
-

Hero Form

-
-
- - -
- -
- - -
- - - -
- - -
- - - - - -
-
- - - - -
- -
-

Hero Form

-
- - {{diagnostic}} -
- - -
- -
- - -
- -
- - -
- - - - -
-
- - - -
- - - TODO: remove this: {{model.name}} - -
- - - TODO: remove this: {{model.name}} - -
- -
- - - - - -
- - -
TODO: remove this: {{spy.className}} - -
- -
diff --git a/public/docs/_examples/forms-deprecated/ts/app/hero-form.component.ts b/public/docs/_examples/forms-deprecated/ts/app/hero-form.component.ts deleted file mode 100644 index 7ea7c44738..0000000000 --- a/public/docs/_examples/forms-deprecated/ts/app/hero-form.component.ts +++ /dev/null @@ -1,66 +0,0 @@ -// #docplaster -// #docregion -// #docregion first, final -import { Component } from '@angular/core'; -import { NgForm } from '@angular/common'; - -import { Hero } from './hero'; - -@Component({ - selector: 'hero-form', - templateUrl: 'app/hero-form.component.html' -}) -export class HeroFormComponent { - - powers = ['Really Smart', 'Super Flexible', - 'Super Hot', 'Weather Changer']; - - model = new Hero(18, 'Dr IQ', this.powers[0], 'Chuck Overstreet'); - - // #docregion submitted - submitted = false; - - onSubmit() { this.submitted = true; } - // #enddocregion submitted - - // #enddocregion final - // TODO: Remove this when we're done - get diagnostic() { return JSON.stringify(this.model); } - // #enddocregion first - - // #docregion final - // Reset the form with a new hero AND restore 'pristine' class state - // by toggling 'active' flag which causes the form - // to be removed/re-added in a tick via NgIf - // TODO: Workaround until NgForm has a reset method (#6822) - // #docregion new-hero - active = true; - - // #docregion new-hero-v1 - newHero() { - this.model = new Hero(42, '', ''); - // #enddocregion new-hero-v1 - this.active = false; - setTimeout(() => this.active = true, 0); - // #docregion new-hero-v1 - } - // #enddocregion new-hero-v1 - // #enddocregion new-hero - // #enddocregion final - //////// NOT SHOWN IN DOCS //////// - - // Reveal in html: - // Name via form.controls = {{showFormControls(heroForm)}} - showFormControls(form: NgForm) { - - return form && form.controls['name'] && - // #docregion form-controls - form.controls['name'].value; // Dr. IQ - // #enddocregion form-controls - } - - ///////////////////////////// - - // #docregion first, final -} -// #enddocregion first, final diff --git a/public/docs/_examples/forms-deprecated/ts/app/hero.ts b/public/docs/_examples/forms-deprecated/ts/app/hero.ts deleted file mode 100644 index c128626452..0000000000 --- a/public/docs/_examples/forms-deprecated/ts/app/hero.ts +++ /dev/null @@ -1,11 +0,0 @@ -// #docregion -export class Hero { - - constructor( - public id: number, - public name: string, - public power: string, - public alterEgo?: string - ) { } - -} diff --git a/public/docs/_examples/forms-deprecated/ts/app/main.ts b/public/docs/_examples/forms-deprecated/ts/app/main.ts deleted file mode 100644 index 5338161d66..0000000000 --- a/public/docs/_examples/forms-deprecated/ts/app/main.ts +++ /dev/null @@ -1,6 +0,0 @@ -// #docregion -import { bootstrap } from '@angular/platform-browser-dynamic'; - -import { AppComponent } from './app.component'; - -bootstrap(AppComponent); diff --git a/public/docs/_examples/forms-deprecated/ts/example-config.json b/public/docs/_examples/forms-deprecated/ts/example-config.json deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/public/docs/_examples/forms-deprecated/ts/forms.css b/public/docs/_examples/forms-deprecated/ts/forms.css deleted file mode 100644 index d7e11405b1..0000000000 --- a/public/docs/_examples/forms-deprecated/ts/forms.css +++ /dev/null @@ -1,9 +0,0 @@ -/* #docregion */ -.ng-valid[required] { - border-left: 5px solid #42A948; /* green */ -} - -.ng-invalid { - border-left: 5px solid #a94442; /* red */ -} -/* #enddocregion */ \ No newline at end of file diff --git a/public/docs/_examples/forms-deprecated/ts/index.html b/public/docs/_examples/forms-deprecated/ts/index.html deleted file mode 100644 index 4df2d32d46..0000000000 --- a/public/docs/_examples/forms-deprecated/ts/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - Hero Form - - - - - - - - - - - - - - - - - - - - - - - - Loading... - - - diff --git a/public/docs/_examples/forms-deprecated/ts/plnkr.json b/public/docs/_examples/forms-deprecated/ts/plnkr.json deleted file mode 100644 index c813933f8e..0000000000 --- a/public/docs/_examples/forms-deprecated/ts/plnkr.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "description": "Forms-Deprecated", - "files":[ - "!**/*.d.ts", - "!**/*.js" - ] -} \ No newline at end of file diff --git a/public/docs/_examples/forms/js/index.html b/public/docs/_examples/forms/js/index.html index fe525d5549..e67b53ac26 100644 --- a/public/docs/_examples/forms/js/index.html +++ b/public/docs/_examples/forms/js/index.html @@ -20,7 +20,7 @@ - + diff --git a/public/docs/_examples/homepage-hello-world/ts/index.1.html b/public/docs/_examples/homepage-hello-world/ts/index.1.html index 849560e3e7..aa342316ab 100644 --- a/public/docs/_examples/homepage-hello-world/ts/index.1.html +++ b/public/docs/_examples/homepage-hello-world/ts/index.1.html @@ -11,10 +11,10 @@ - + - + diff --git a/public/docs/_examples/homepage-tabs/ts/index.1.html b/public/docs/_examples/homepage-tabs/ts/index.1.html index 650735970f..600739b704 100644 --- a/public/docs/_examples/homepage-tabs/ts/index.1.html +++ b/public/docs/_examples/homepage-tabs/ts/index.1.html @@ -12,10 +12,10 @@ - + - + diff --git a/public/docs/_examples/homepage-todo/ts/index.1.html b/public/docs/_examples/homepage-todo/ts/index.1.html index c541fe0f30..181cf44ce2 100644 --- a/public/docs/_examples/homepage-todo/ts/index.1.html +++ b/public/docs/_examples/homepage-todo/ts/index.1.html @@ -12,10 +12,10 @@ - + - + diff --git a/public/docs/_examples/karma-test-shim.js b/public/docs/_examples/karma-test-shim.js deleted file mode 100644 index 5fb73d0301..0000000000 --- a/public/docs/_examples/karma-test-shim.js +++ /dev/null @@ -1,50 +0,0 @@ -// /*global jasmine, __karma__, window*/ -Error.stackTraceLimit = Infinity; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; - -__karma__.loaded = function () { -}; - -function isJsFile(path) { - return path.slice(-3) == '.js'; -} - -function isSpecFile(path) { - return /\.spec\.js$/.test(path); -} - -function isBuiltFile(path) { - var builtPath = '/base/app/'; - return isJsFile(path) && (path.substr(0, builtPath.length) == builtPath); -} - -var allSpecFiles = Object.keys(window.__karma__.files) - .filter(isSpecFile) - .filter(isBuiltFile); - -System.config({ - baseURL: '/base', - packageWithIndex: true // sadly, we can't use umd packages (yet?) -}); - -System.import('systemjs.config.js') - .then(() => Promise.all([ - System.import('@angular/core/testing'), - System.import('@angular/platform-browser-dynamic/testing') - ])) - .then((providers) => { - var coreTesting = providers[0]; - var browserTesting = providers[1]; - coreTesting.TestBed.initTestEnvironment( - browserTesting.BrowserDynamicTestingModule, - browserTesting.platformBrowserDynamicTesting()); - }) - .then(function () { - // Finally, load all spec files. - // This will run the tests directly. - return Promise.all( - allSpecFiles.map(function (moduleName) { - return System.import(moduleName); - })); - }) - .then(__karma__.start, __karma__.error); diff --git a/public/docs/_examples/package.json b/public/docs/_examples/package.json index 93215c5d5e..7baee8a5a9 100644 --- a/public/docs/_examples/package.json +++ b/public/docs/_examples/package.json @@ -19,33 +19,39 @@ "start:webpack": "webpack-dev-server --inline --progress --port 8080", "test:webpack": "karma start karma.webpack.conf.js", "build:webpack": "rimraf dist && webpack --config config/webpack.prod.js --bail", - "build:cli": "ng build" + "build:cli": "ng build", + "build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup.js" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { - "@angular/common": "2.0.0-rc.6", - "@angular/compiler": "2.0.0-rc.6", - "@angular/compiler-cli": "0.6.0", - "@angular/core": "2.0.0-rc.6", - "@angular/forms": "2.0.0-rc.6", - "@angular/http": "2.0.0-rc.6", - "@angular/platform-browser": "2.0.0-rc.6", - "@angular/platform-browser-dynamic": "2.0.0-rc.6", - "@angular/router": "3.0.0-rc.2", - "@angular/upgrade": "2.0.0-rc.6", - "angular2-in-memory-web-api": "0.0.18", + "@angular/common": "2.0.0", + "@angular/compiler": "2.0.0", + "@angular/compiler-cli": "0.6.2", + "@angular/core": "2.0.0", + "@angular/forms": "2.0.0", + "@angular/http": "2.0.0", + "@angular/platform-browser": "2.0.0", + "@angular/platform-browser-dynamic": "2.0.0", + "@angular/platform-server": "2.0.0", + "@angular/router": "3.0.0", + "@angular/upgrade": "2.0.0", + "angular2-in-memory-web-api": "0.0.20", "bootstrap": "^3.3.6", "core-js": "^2.4.1", "reflect-metadata": "^0.1.3", - "rxjs": "5.0.0-beta.11", + "rollup": "^0.34.13", + "rollup-plugin-node-resolve": "^2.0.0", + "rollup-plugin-uglify": "^1.0.1", + "rxjs": "5.0.0-beta.12", "systemjs": "0.19.27", - "zone.js": "^0.6.17" + "zone.js": "^0.6.23" }, "devDependencies": { "angular-cli": "^1.0.0-beta.5", "angular2-template-loader": "^0.4.0", + "awesome-typescript-loader": "^2.2.4", "canonical-path": "0.0.2", "concurrently": "^2.2.0", "css-loader": "^0.23.1", @@ -60,6 +66,7 @@ "karma-cli": "^1.0.1", "karma-htmlfile-reporter": "^0.3.4", "karma-jasmine": "^1.0.2", + "karma-jasmine-html-reporter": "^0.2.2", "karma-phantomjs-launcher": "^1.0.2", "karma-sourcemap-loader": "^0.3.7", "karma-webpack": "^1.8.0", @@ -70,11 +77,12 @@ "protractor": "^3.3.0", "raw-loader": "^0.5.1", "rimraf": "^2.5.2", + "rollup-plugin-commonjs": "^4.1.0", "style-loader": "^0.13.1", "ts-loader": "^0.8.2", - "ts-node": "^0.7.3", + "ts-node": "^1.3.0", "tslint": "^3.15.1", - "typescript": "^1.8.10", + "typescript": "^2.0.2", "typings": "^1.3.2", "webpack": "^1.13.0", "webpack-dev-server": "^1.14.1", diff --git a/public/docs/_examples/quickstart/js/index.html b/public/docs/_examples/quickstart/js/index.html index b127bdce13..551e4fb134 100644 --- a/public/docs/_examples/quickstart/js/index.html +++ b/public/docs/_examples/quickstart/js/index.html @@ -16,7 +16,7 @@ - + diff --git a/public/docs/_examples/quickstart/js/package.1.json b/public/docs/_examples/quickstart/js/package.1.json index 971b6b5d2b..cca103a52f 100644 --- a/public/docs/_examples/quickstart/js/package.1.json +++ b/public/docs/_examples/quickstart/js/package.1.json @@ -7,23 +7,22 @@ }, "license": "ISC", "dependencies": { - "@angular/common": "2.0.0-rc.6", - "@angular/compiler": "2.0.0-rc.6", - "@angular/core": "2.0.0-rc.6", - "@angular/forms": "2.0.0-rc.6", - "@angular/http": "2.0.0-rc.6", - "@angular/platform-browser": "2.0.0-rc.6", - "@angular/platform-browser-dynamic": "2.0.0-rc.6", - "@angular/router": "3.0.0-rc.2", - "@angular/router-deprecated": "2.0.0-rc.2", - "@angular/upgrade": "2.0.0-rc.6", + "@angular/common": "2.0.0", + "@angular/compiler": "2.0.0", + "@angular/core": "2.0.0", + "@angular/forms": "2.0.0", + "@angular/http": "2.0.0", + "@angular/platform-browser": "2.0.0", + "@angular/platform-browser-dynamic": "2.0.0", + "@angular/router": "3.0.0", + "@angular/upgrade": "2.0.0", "core-js": "^2.4.1", - "reflect-metadata": "0.1.3", - "rxjs": "5.0.0-beta.11", - "zone.js": "0.6.17", + "reflect-metadata": "^0.1.3", + "rxjs": "5.0.0-beta.12", + "zone.js": "^0.6.23", - "angular2-in-memory-web-api": "0.0.18", + "angular2-in-memory-web-api": "0.0.20", "bootstrap": "^3.3.6" }, "devDependencies": { diff --git a/public/docs/_examples/quickstart/ts/package.1.json b/public/docs/_examples/quickstart/ts/package.1.json index 5d9d1f6c24..4fe519331e 100644 --- a/public/docs/_examples/quickstart/ts/package.1.json +++ b/public/docs/_examples/quickstart/ts/package.1.json @@ -11,30 +11,29 @@ }, "license": "ISC", "dependencies": { - "@angular/common": "2.0.0-rc.6", - "@angular/compiler": "2.0.0-rc.6", - "@angular/compiler-cli": "0.6.0", - "@angular/core": "2.0.0-rc.6", - "@angular/forms": "2.0.0-rc.6", - "@angular/http": "2.0.0-rc.6", - "@angular/platform-browser": "2.0.0-rc.6", - "@angular/platform-browser-dynamic": "2.0.0-rc.6", - "@angular/router": "3.0.0-rc.2", - "@angular/upgrade": "2.0.0-rc.6", + "@angular/common": "2.0.0", + "@angular/compiler": "2.0.0", + "@angular/core": "2.0.0", + "@angular/forms": "2.0.0", + "@angular/http": "2.0.0", + "@angular/platform-browser": "2.0.0", + "@angular/platform-browser-dynamic": "2.0.0", + "@angular/router": "3.0.0", + "@angular/upgrade": "2.0.0", "core-js": "^2.4.1", "reflect-metadata": "^0.1.3", - "rxjs": "5.0.0-beta.11", + "rxjs": "5.0.0-beta.12", "systemjs": "0.19.27", - "zone.js": "^0.6.17", + "zone.js": "^0.6.23", - "angular2-in-memory-web-api": "0.0.18", + "angular2-in-memory-web-api": "0.0.20", "bootstrap": "^3.3.6" }, "devDependencies": { "concurrently": "^2.2.0", "lite-server": "^2.2.2", - "typescript": "^1.8.10", + "typescript": "^2.0.2", "typings":"^1.3.2" } } diff --git a/public/docs/_examples/quickstart/ts/typings.1.json b/public/docs/_examples/quickstart/ts/typings.1.json index 72db971273..7da31ca0af 100644 --- a/public/docs/_examples/quickstart/ts/typings.1.json +++ b/public/docs/_examples/quickstart/ts/typings.1.json @@ -2,6 +2,6 @@ "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+20160831021119" + "node": "registry:dt/node#6.0.0+20160909174046" } } diff --git a/public/docs/_examples/router-deprecated/e2e-spec.ts.disabled b/public/docs/_examples/router-deprecated/e2e-spec.ts.disabled deleted file mode 100644 index 3892285845..0000000000 --- a/public/docs/_examples/router-deprecated/e2e-spec.ts.disabled +++ /dev/null @@ -1,127 +0,0 @@ -/// -'use strict'; -describe('Router', function () { - - beforeAll(function () { - browser.get(''); - }); - - function getPageStruct() { - let hrefEles = element.all(by.css('my-app a')); - - return { - hrefs: hrefEles, - routerParent: element(by.css('my-app > undefined')), - routerTitle: element(by.css('my-app > undefined > h2')), - - crisisHref: hrefEles.get(0), - crisisList: element.all(by.css('my-app > undefined > undefined li')), - crisisDetail: element(by.css('my-app > undefined > undefined > div')), - crisisDetailTitle: element(by.css('my-app > undefined > undefined > div > h3')), - - heroesHref: hrefEles.get(1), - heroesList: element.all(by.css('my-app > undefined li')), - heroDetail: element(by.css('my-app > undefined > div')), - heroDetailTitle: element(by.css('my-app > undefined > div > h3')), - - }; - } - - it('should be able to see the start screen', function () { - let page = getPageStruct(); - expect(page.hrefs.count()).toEqual(2, 'should be two dashboard choices'); - expect(page.crisisHref.getText()).toEqual('Crisis Center'); - expect(page.heroesHref.getText()).toEqual('Heroes'); - }); - - it('should be able to see crises center items', function () { - let page = getPageStruct(); - expect(page.crisisList.count()).toBe(4, 'should be 4 crisis center entries at start'); - }); - - it('should be able to see hero items', function () { - let page = getPageStruct(); - page.heroesHref.click().then(function() { - expect(page.routerTitle.getText()).toContain('HEROES'); - expect(page.heroesList.count()).toBe(6, 'should be 6 heroes'); - }); - }); - - it('should be able to toggle the views', function () { - let page = getPageStruct(); - page.crisisHref.click().then(function() { - expect(page.crisisList.count()).toBe(4, 'should be 4 crisis center entries'); - return page.heroesHref.click(); - }).then(function() { - expect(page.heroesList.count()).toBe(6, 'should be 6 heroes'); - }); - }); - - it('should be able to edit and save details from the crisis center view', function () { - crisisCenterEdit(2, true); - }); - - it('should be able to edit and cancel details from the crisis center view', function () { - crisisCenterEdit(3, false); - }); - - it('should be able to edit and save details from the heroes view', function () { - let page = getPageStruct(); - let heroEle: protractor.ElementFinder; - let heroText: string; - page.heroesHref.click().then(function() { - heroEle = page.heroesList.get(4); - return heroEle.getText(); - }).then(function(text) { - expect(text.length).toBeGreaterThan(0, 'should have some text'); - // remove leading id from text - heroText = text.substr(text.indexOf(' ')).trim(); - return heroEle.click(); - }).then(function() { - expect(page.heroesList.count()).toBe(0, 'should no longer see crisis center entries'); - expect(page.heroDetail.isPresent()).toBe(true, 'should be able to see crisis detail'); - expect(page.heroDetailTitle.getText()).toContain(heroText); - let inputEle = page.heroDetail.element(by.css('input')); - return sendKeys(inputEle, '-foo'); - }).then(function() { - expect(page.heroDetailTitle.getText()).toContain(heroText + '-foo'); - let buttonEle = page.heroDetail.element(by.css('button')); - return buttonEle.click(); - }).then(function() { - expect(heroEle.getText()).toContain(heroText + '-foo'); - }); - }); - - function crisisCenterEdit(index: number, shouldSave: boolean) { - let page = getPageStruct(); - let crisisEle: protractor.ElementFinder; - let crisisText: string; - page.crisisHref.click() - .then(function () { - crisisEle = page.crisisList.get(index); - return crisisEle.getText(); - }).then(function (text) { - expect(text.length).toBeGreaterThan(0, 'should have some text'); - // remove leading id from text - crisisText = text.substr(text.indexOf(' ')).trim(); - return crisisEle.click(); - }).then(function () { - expect(page.crisisList.count()).toBe(0, 'should no longer see crisis center entries'); - expect(page.crisisDetail.isPresent()).toBe(true, 'should be able to see crisis detail'); - expect(page.crisisDetailTitle.getText()).toContain(crisisText); - let inputEle = page.crisisDetail.element(by.css('input')); - return sendKeys(inputEle, '-foo'); - }).then(function () { - expect(page.crisisDetailTitle.getText()).toContain(crisisText + '-foo'); - let buttonEle = page.crisisDetail.element(by.cssContainingText('button', shouldSave ? 'Save' : 'Cancel')); - return buttonEle.click(); - }).then(function () { - if (shouldSave) { - expect(crisisEle.getText()).toContain(crisisText + '-foo'); - } else { - expect(crisisEle.getText()).not.toContain(crisisText + '-foo'); - } - }); - } - -}); diff --git a/public/docs/_examples/router-deprecated/ts/app/app.component.1.ts b/public/docs/_examples/router-deprecated/ts/app/app.component.1.ts deleted file mode 100644 index 0e20623fd3..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/app.component.1.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* First version */ -// #docplaster - -// #docregion -import { Component } from '@angular/core'; -// #docregion import-router -import { RouteConfig, ROUTER_DIRECTIVES } from '@angular/router-deprecated'; -// #enddocregion import-router - -import { CrisisListComponent } from './crisis-list.component'; -import { HeroListComponent } from './hero-list.component'; - -@Component({ - selector: 'my-app', -// #docregion template - template: ` -

Component Router (Deprecated)

- - - `, -// #enddocregion template - directives: [ROUTER_DIRECTIVES] -}) -// #enddocregion -/* -// #docregion route-config -@Component({ ... }) -// #enddocregion route-config -*/ -// #docregion -// #docregion route-config -@RouteConfig([ -// #docregion route-defs - {path: '/crisis-center', name: 'CrisisCenter', component: CrisisListComponent}, - {path: '/heroes', name: 'Heroes', component: HeroListComponent} -// #enddocregion route-defs -]) -export class AppComponent { } -// #enddocregion route-config -// #enddocregion diff --git a/public/docs/_examples/router-deprecated/ts/app/app.component.2.ts b/public/docs/_examples/router-deprecated/ts/app/app.component.2.ts deleted file mode 100644 index e4685ff418..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/app.component.2.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* Second Heroes version */ -// #docplaster - -// #docregion -import { Component } from '@angular/core'; -import { RouteConfig, ROUTER_DIRECTIVES } from '@angular/router-deprecated'; - -import { CrisisListComponent } from './crisis-list.component'; -// #enddocregion -/* -// Apparent Milestone 2 imports -// #docregion -// #docregion hero-import -import { HeroListComponent } from './heroes/hero-list.component'; -import { HeroDetailComponent } from './heroes/hero-detail.component'; -import { HeroService } from './heroes/hero.service'; -// #enddocregion hero-import -// #enddocregion -*/ -// Actual Milestone 2 imports -import { HeroListComponent } from './heroes/hero-list.component.1'; -import { HeroDetailComponent } from './heroes/hero-detail.component.1'; -import { HeroService } from './heroes/hero.service'; -// #docregion - -@Component({ - selector: 'my-app', - template: ` -

Component Router (Deprecated)

- - - `, - providers: [HeroService], - directives: [ROUTER_DIRECTIVES] -}) -// #enddocregion -/* -// #docregion route-config -@Component({ ... }) -// #enddocregion route-config -*/ -// #docregion -// #docregion route-config -@RouteConfig([ -// #docregion route-defs - {path: '/crisis-center', name: 'CrisisCenter', component: CrisisListComponent}, - {path: '/heroes', name: 'Heroes', component: HeroListComponent}, - // #docregion hero-detail-route - {path: '/hero/:id', name: 'HeroDetail', component: HeroDetailComponent} - // #enddocregion hero-detail-route -// #enddocregion route-defs -]) -export class AppComponent { } -// #enddocregion route-config -// #enddocregion diff --git a/public/docs/_examples/router-deprecated/ts/app/app.component.3.ts b/public/docs/_examples/router-deprecated/ts/app/app.component.3.ts deleted file mode 100644 index 68635e8aad..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/app.component.3.ts +++ /dev/null @@ -1,52 +0,0 @@ -// #docplaster -import { Component } from '@angular/core'; -import { RouteConfig, ROUTER_DIRECTIVES } from '@angular/router-deprecated'; - -import { CrisisCenterComponent } from './crisis-center/crisis-center.component.1'; -import { DialogService } from './dialog.service'; -import { HeroService } from './heroes/hero.service'; - -@Component({ - selector: 'my-app', -// #enddocregion - /* Typical link - // #docregion h-anchor - Heroes - // #enddocregion h-anchor - */ - /* Incomplete Crisis Center link when CC lacks a default - // #docregion cc-anchor-fail - // The link now fails with a "non-terminal link" error - // #docregion cc-anchor-w-default - Crisis Center - // #enddocregion cc-anchor-w-default - // #enddocregion cc-anchor-fail - */ - /* Crisis Center link when CC lacks a default - // #docregion cc-anchor-no-default - Crisis Center - // #enddocregion cc-anchor-no-default - */ - /* Crisis Center Detail link - // #docregion Dragon-anchor - Dragon Crisis - // #enddocregion Dragon-anchor - */ -// #docregion template - template: ` -

Component Router (Deprecated)

- - - `, -// #enddocregion template - providers: [DialogService, HeroService], - directives: [ROUTER_DIRECTIVES] -}) -@RouteConfig([ - {path: '/crisis-center/...', name: 'CrisisCenter', component: CrisisCenterComponent}, -]) -export class AppComponent { } diff --git a/public/docs/_examples/router-deprecated/ts/app/app.component.ts b/public/docs/_examples/router-deprecated/ts/app/app.component.ts deleted file mode 100644 index a6f784cda9..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/app.component.ts +++ /dev/null @@ -1,44 +0,0 @@ -// #docplaster -// #docregion -import { Component } from '@angular/core'; -import { RouteConfig, ROUTER_DIRECTIVES } from '@angular/router-deprecated'; - -import { CrisisCenterComponent } from './crisis-center/crisis-center.component'; -import { HeroListComponent } from './heroes/hero-list.component'; -import { HeroDetailComponent } from './heroes/hero-detail.component'; - -import { DialogService } from './dialog.service'; -import { HeroService } from './heroes/hero.service'; - -@Component({ - selector: 'my-app', -// #docregion template - template: ` -

Component Router (Deprecated)

- - - `, -// #enddocregion template - providers: [DialogService, HeroService], - directives: [ROUTER_DIRECTIVES] -}) -// #docregion route-config -@RouteConfig([ - - // #docregion route-config-cc - { // Crisis Center child route - path: '/crisis-center/...', - name: 'CrisisCenter', - component: CrisisCenterComponent, - useAsDefault: true - }, - // #enddocregion route-config-cc - - {path: '/heroes', name: 'Heroes', component: HeroListComponent}, - {path: '/hero/:id', name: 'HeroDetail', component: HeroDetailComponent}, -]) -// #enddocregion route-config -export class AppComponent { } diff --git a/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-center.component.1.ts b/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-center.component.1.ts deleted file mode 100644 index 6925fb8008..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-center.component.1.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Component } from '@angular/core'; -import { RouteConfig, RouterOutlet } from '@angular/router-deprecated'; - -import { CrisisListComponent } from './crisis-list.component.1'; -import { CrisisDetailComponent } from './crisis-detail.component.1'; -import { CrisisService } from './crisis.service'; - -// #docregion minus-imports -@Component({ - template: ` -

CRISIS CENTER

- - `, - directives: [RouterOutlet], -// #docregion providers - providers: [CrisisService] -// #enddocregion providers -}) -// #docregion route-config -@RouteConfig([ - // #docregion default-route - {path: '/', name: 'CrisisList', component: CrisisListComponent, useAsDefault: true}, - // #enddocregion default-route - {path: '/:id', name: 'CrisisDetail', component: CrisisDetailComponent} -]) -// #enddocregion route-config -export class CrisisCenterComponent { } -// #enddocregion minus-imports diff --git a/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-center.component.ts b/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-center.component.ts deleted file mode 100644 index 3c735ae6ae..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-center.component.ts +++ /dev/null @@ -1,22 +0,0 @@ -// #docregion -import { Component } from '@angular/core'; -import { RouteConfig, RouterOutlet } from '@angular/router-deprecated'; - -import { CrisisListComponent } from './crisis-list.component'; -import { CrisisDetailComponent } from './crisis-detail.component'; -import { CrisisService } from './crisis.service'; - -@Component({ - template: ` -

CRISIS CENTER

- - `, - directives: [RouterOutlet], - providers: [CrisisService] -}) -@RouteConfig([ - {path: '/', name: 'CrisisList', component: CrisisListComponent, useAsDefault: true}, - {path: '/:id', name: 'CrisisDetail', component: CrisisDetailComponent} -]) -export class CrisisCenterComponent { } -// #enddocregion diff --git a/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-detail.component.1.ts b/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-detail.component.1.ts deleted file mode 100644 index 0c683853c9..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-detail.component.1.ts +++ /dev/null @@ -1,95 +0,0 @@ -// #docplaster - -// #docregion -import { Component, OnInit } from '@angular/core'; -import { RouteParams, Router } from '@angular/router-deprecated'; -// #docregion routerCanDeactivate -import { CanDeactivate, ComponentInstruction } from '@angular/router-deprecated'; - -import { DialogService } from '../dialog.service'; - -// #enddocregion routerCanDeactivate -import { Crisis, CrisisService } from './crisis.service'; - -@Component({ - // #docregion template - template: ` -
-

"{{editName}}"

-
- {{crisis.id}}
-
- - -
-

- - -

-
- `, - // #enddocregion template - styles: ['input {width: 20em}'] -}) -// #docregion routerCanDeactivate, cancel-save -export class CrisisDetailComponent implements OnInit, CanDeactivate { - - crisis: Crisis; - editName: string; - -// #enddocregion routerCanDeactivate, cancel-save - constructor( - private service: CrisisService, - private router: Router, - private routeParams: RouteParams, - private dialog: DialogService - ) { } - - // #docregion ngOnInit - ngOnInit() { - let id = +this.routeParams.get('id'); - this.service.getCrisis(id).then(crisis => { - if (crisis) { - this.editName = crisis.name; - this.crisis = crisis; - } else { // id not found - this.gotoCrises(); - } - }); - } - // #enddocregion ngOnInit - - // #docregion routerCanDeactivate - routerCanDeactivate(next: ComponentInstruction, prev: ComponentInstruction): any { - // Allow synchronous navigation (`true`) if no crisis or the crisis is unchanged. - if (!this.crisis || this.crisis.name === this.editName) { - return true; - } - // Otherwise ask the user with the dialog service and return its - // promise which resolves to true or false when the user decides - return this.dialog.confirm('Discard changes?'); - } - // #enddocregion routerCanDeactivate - - // #docregion cancel-save - cancel() { - this.editName = this.crisis.name; - this.gotoCrises(); - } - - save() { - this.crisis.name = this.editName; - this.gotoCrises(); - } - // #enddocregion cancel-save - - // #docregion gotoCrises - gotoCrises() { - // Like Crisis Center -

"{{editName}}"

-
- {{crisis.id}}
-
- - -
-

- - -

-
- `, - styles: ['input {width: 20em}'] -}) - -export class CrisisDetailComponent implements OnInit, CanDeactivate { - - crisis: Crisis; - editName: string; - - constructor( - private service: CrisisService, - private router: Router, - private routeParams: RouteParams, - private _dialog: DialogService - ) { } - - ngOnInit() { - let id = +this.routeParams.get('id'); - this.service.getCrisis(id).then(crisis => { - if (crisis) { - this.editName = crisis.name; - this.crisis = crisis; - } else { // id not found - this.gotoCrises(); - } - }); - } - - routerCanDeactivate(next: ComponentInstruction, prev: ComponentInstruction): any { - // Allow synchronous navigation (`true`) if no crisis or the crisis is unchanged. - if (!this.crisis || this.crisis.name === this.editName) { - return true; - } - // Otherwise ask the user with the dialog service and return its - // promise which resolves to true or false when the user decides - return this._dialog.confirm('Discard changes?'); - } - - cancel() { - this.editName = this.crisis.name; - this.gotoCrises(); - } - - save() { - this.crisis.name = this.editName; - this.gotoCrises(); - } - - // #docregion gotoCrises - gotoCrises() { - let crisisId = this.crisis ? this.crisis.id : null; - // Pass along the hero id if available - // so that the CrisisListComponent can select that hero. - // Add a totally useless `foo` parameter for kicks. - // #docregion gotoCrises-navigate - this.router.navigate(['CrisisList', {id: crisisId, foo: 'foo'} ]); - // #enddocregion gotoCrises-navigate - } - // #enddocregion gotoCrises -} diff --git a/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-list.component.1.ts b/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-list.component.1.ts deleted file mode 100644 index 45121da69e..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-list.component.1.ts +++ /dev/null @@ -1,37 +0,0 @@ -// #docplaster - -// #docregion -import { Component, OnInit } from '@angular/core'; -import { Router } from '@angular/router-deprecated'; - -import { Crisis, CrisisService } from './crisis.service'; - -@Component({ - // #docregion template - template: ` - - `, - // #enddocregion template -}) -export class CrisisListComponent implements OnInit { - crises: Crisis[]; - - constructor( - private service: CrisisService, - private router: Router) {} - - ngOnInit() { - this.service.getCrises().then(crises => this.crises = crises); - } - - // #docregion select - onSelect(crisis: Crisis) { - this.router.navigate(['CrisisDetail', { id: crisis.id }] ); - } - // #enddocregion select -} diff --git a/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-list.component.ts b/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-list.component.ts deleted file mode 100644 index a5770d256f..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis-list.component.ts +++ /dev/null @@ -1,41 +0,0 @@ -// #docplaster - -// #docregion -import { Component, OnInit } from '@angular/core'; -import { RouteParams, Router } from '@angular/router-deprecated'; - -import { Crisis, CrisisService } from './crisis.service'; - -@Component({ - template: ` - - `, -}) -export class CrisisListComponent implements OnInit { - crises: Crisis[]; - - private selectedId: number; - - constructor( - private service: CrisisService, - private router: Router, - routeParams: RouteParams) { - this.selectedId = +routeParams.get('id'); - } - - isSelected(crisis: Crisis) { return crisis.id === this.selectedId; } - - ngOnInit() { - this.service.getCrises().then(crises => this.crises = crises); - } - - onSelect(crisis: Crisis) { - this.router.navigate( ['CrisisDetail', { id: crisis.id }] ); - } -} diff --git a/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis.service.ts b/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis.service.ts deleted file mode 100644 index a847a15217..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/crisis-center/crisis.service.ts +++ /dev/null @@ -1,40 +0,0 @@ -// #docplaster -// #docregion -import { Injectable } from '@angular/core'; - -export class Crisis { - constructor(public id: number, public name: string) { } -} - -let crises = [ - new Crisis(1, 'Dragon Burning Cities'), - new Crisis(2, 'Sky Rains Great White Sharks'), - new Crisis(3, 'Giant Asteroid Heading For Earth'), - new Crisis(4, 'Procrastinators Meeting Delayed Again'), -]; - -let crisesPromise = Promise.resolve(crises); - -@Injectable() -export class CrisisService { - getCrises() { return crisesPromise; } - - getCrisis(id: number | string) { - return crisesPromise - .then(crises => crises.find(c => c.id === +id)); - } - -// #enddocregion - - static nextCrisisId = 100; - - addCrisis(name: string) { - name = name.trim(); - if (name) { - let crisis = new Crisis(CrisisService.nextCrisisId++, name); - crisesPromise.then(crises => crises.push(crisis)); - } - } -// #docregion -} -// #enddocregion diff --git a/public/docs/_examples/router-deprecated/ts/app/crisis-list.component.ts b/public/docs/_examples/router-deprecated/ts/app/crisis-list.component.ts deleted file mode 100644 index 6caa3653b5..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/crisis-list.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Initial empty version -// #docregion -import { Component } from '@angular/core'; - -@Component({ - template: ` -

CRISIS CENTER

-

Get your crisis here

` -}) -export class CrisisListComponent { } diff --git a/public/docs/_examples/router-deprecated/ts/app/dialog.service.ts b/public/docs/_examples/router-deprecated/ts/app/dialog.service.ts deleted file mode 100644 index 71a342cbe8..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/dialog.service.ts +++ /dev/null @@ -1,18 +0,0 @@ -// #docregion -import { Injectable } from '@angular/core'; -/** - * Async modal dialog service - * DialogService makes this app easier to test by faking this service. - * TODO: better modal implementation that doesn't use window.confirm - */ -@Injectable() -export class DialogService { - /** - * Ask user to confirm an action. `message` explains the action and choices. - * Returns promise resolving to `true`=confirm or `false`=cancel - */ - confirm(message?: string) { - return new Promise((resolve, reject) => - resolve(window.confirm(message || 'Is it OK?'))); - }; -} diff --git a/public/docs/_examples/router-deprecated/ts/app/hero-list.component.ts b/public/docs/_examples/router-deprecated/ts/app/hero-list.component.ts deleted file mode 100644 index 5dbbe17d8e..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/hero-list.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// Initial empty version -// #docregion -import { Component } from '@angular/core'; - -@Component({ - template: ` -

HEROES

-

Get your heroes here

` -}) -export class HeroListComponent { } diff --git a/public/docs/_examples/router-deprecated/ts/app/heroes/hero-detail.component.1.ts b/public/docs/_examples/router-deprecated/ts/app/heroes/hero-detail.component.1.ts deleted file mode 100644 index ebfa0bf21d..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/heroes/hero-detail.component.1.ts +++ /dev/null @@ -1,47 +0,0 @@ -// #docregion -import { Component, OnInit } from '@angular/core'; -import { RouteParams, Router } from '@angular/router-deprecated'; - -import { Hero, HeroService } from './hero.service'; - -@Component({ - template: ` -

HEROES

-
-

"{{hero.name}}"

-
- {{hero.id}}
-
- - -
-

- -

-
- `, -}) -export class HeroDetailComponent implements OnInit { - hero: Hero; - - // #docregion ctor - constructor( - private router: Router, - private routeParams: RouteParams, - private service: HeroService) {} - // #enddocregion ctor - - // #docregion ngOnInit - ngOnInit() { - let id = this.routeParams.get('id'); - this.service.getHero(id).then(hero => this.hero = hero); - } - // #enddocregion ngOnInit - - // #docregion gotoHeroes - gotoHeroes() { - // Like Heroes - this.router.navigate(['Heroes']); - } - // #enddocregion gotoHeroes -} diff --git a/public/docs/_examples/router-deprecated/ts/app/heroes/hero-detail.component.ts b/public/docs/_examples/router-deprecated/ts/app/heroes/hero-detail.component.ts deleted file mode 100644 index 10e73fd27b..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/heroes/hero-detail.component.ts +++ /dev/null @@ -1,52 +0,0 @@ -// #docregion -import { Component, OnInit } from '@angular/core'; -import { RouteParams, Router } from '@angular/router-deprecated'; - -import { Hero, HeroService } from './hero.service'; - -@Component({ - template: ` -

HEROES

-
-

"{{hero.name}}"

-
- {{hero.id}}
-
- - -
-

- -

-
- `, -}) -export class HeroDetailComponent implements OnInit { - hero: Hero; - - // #docregion ctor - constructor( - private router: Router, - private routeParams: RouteParams, - private service: HeroService) {} - // #enddocregion ctor - - // #docregion ngOnInit - ngOnInit() { - let id = this.routeParams.get('id'); - this.service.getHero(id).then(hero => this.hero = hero); - } - // #enddocregion ngOnInit - - // #docregion gotoHeroes - gotoHeroes() { - let heroId = this.hero ? this.hero.id : null; - // Pass along the hero id if available - // so that the HeroList component can select that hero. - // Add a totally useless `foo` parameter for kicks. - // #docregion gotoHeroes-navigate - this.router.navigate(['Heroes', {id: heroId, foo: 'foo'} ]); - // #enddocregion gotoHeroes-navigate - } - // #enddocregion gotoHeroes -} diff --git a/public/docs/_examples/router-deprecated/ts/app/heroes/hero-list.component.1.ts b/public/docs/_examples/router-deprecated/ts/app/heroes/hero-list.component.1.ts deleted file mode 100644 index cb1d20327c..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/heroes/hero-list.component.1.ts +++ /dev/null @@ -1,50 +0,0 @@ -// #docplaster - -// #docregion -// TODO SOMEDAY: Feature Componetized like HeroCenter -import { Component, OnInit } from '@angular/core'; -import { Router } from '@angular/router-deprecated'; - -import { Hero, HeroService } from './hero.service'; - -@Component({ - // #docregion template - template: ` -

HEROES

- - ` - // #enddocregion template -}) -export class HeroListComponent implements OnInit { - heroes: Hero[]; - - // #docregion ctor - constructor( - private router: Router, - private service: HeroService) { } - // #enddocregion ctor - - ngOnInit() { - this.service.getHeroes().then(heroes => this.heroes = heroes); - } - - // #docregion select - onSelect(hero: Hero) { - // #docregion nav-to-detail - this.router.navigate( ['HeroDetail', { id: hero.id }] ); - // #enddocregion nav-to-detail - } - // #enddocregion select -} -// #enddocregion - -/* A link parameters array -// #docregion link-parameters-array -['HeroDetail', { id: hero.id }] // {id: 15} -// #enddocregion link-parameters-array -*/ diff --git a/public/docs/_examples/router-deprecated/ts/app/heroes/hero-list.component.ts b/public/docs/_examples/router-deprecated/ts/app/heroes/hero-list.component.ts deleted file mode 100644 index 1ca787592f..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/heroes/hero-list.component.ts +++ /dev/null @@ -1,56 +0,0 @@ -// #docplaster - -// TODO SOMEDAY: Feature Componetized like CrisisCenter -// #docregion -import { Component, OnInit } from '@angular/core'; -// #docregion import-route-params -import { RouteParams, Router } from '@angular/router-deprecated'; -// #enddocregion import-route-params - -import { Hero, HeroService } from './hero.service'; - -@Component({ - // #docregion template - template: ` -

HEROES

- - ` - // #enddocregion template -}) -export class HeroListComponent implements OnInit { - heroes: Hero[]; - - // #docregion ctor - private selectedId: number; - - constructor( - private service: HeroService, - private router: Router, - routeParams: RouteParams) { - this.selectedId = +routeParams.get('id'); - } - // #enddocregion ctor - - // #docregion isSelected - isSelected(hero: Hero) { return hero.id === this.selectedId; } - // #enddocregion isSelected - - // #docregion select - onSelect(hero: Hero) { - this.router.navigate( ['HeroDetail', { id: hero.id }] ); - } - // #enddocregion select - - ngOnInit() { - - - this.service.getHeroes().then(heroes => this.heroes = heroes); - } -} -// #enddocregion diff --git a/public/docs/_examples/router-deprecated/ts/app/heroes/hero.service.ts b/public/docs/_examples/router-deprecated/ts/app/heroes/hero.service.ts deleted file mode 100644 index c819bd2632..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/heroes/hero.service.ts +++ /dev/null @@ -1,27 +0,0 @@ -// #docregion -import { Injectable } from '@angular/core'; - -export class Hero { - constructor(public id: number, public name: string) { } -} - -let HEROES = [ - new Hero(11, 'Mr. Nice'), - new Hero(12, 'Narco'), - new Hero(13, 'Bombasto'), - new Hero(14, 'Celeritas'), - new Hero(15, 'Magneta'), - new Hero(16, 'RubberMan') -]; - -let heroesPromise = Promise.resolve(HEROES); - -@Injectable() -export class HeroService { - getHeroes() { return heroesPromise; } - - getHero(id: number | string) { - return heroesPromise - .then(heroes => heroes.find(h => h.id === +id)); - } -} diff --git a/public/docs/_examples/router-deprecated/ts/app/main.1.ts b/public/docs/_examples/router-deprecated/ts/app/main.1.ts deleted file mode 100644 index ce110455d4..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/main.1.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* First version */ -// #docplaster - -// #docregion all -import { bootstrap } from '@angular/platform-browser-dynamic'; -import { ROUTER_PROVIDERS } from '@angular/router-deprecated'; - -import { AppComponent } from './app.component'; - -// #enddocregion all - -/* Can't use AppComponent ... but display as if we can -// #docregion all -bootstrap(AppComponent, [ -// #enddocregion all -*/ - -// Actually use the v.1 component -import { AppComponent as ac } from './app.component.1'; -bootstrap(ac, [ -// #docregion all - ROUTER_PROVIDERS -]); -// #enddocregion all diff --git a/public/docs/_examples/router-deprecated/ts/app/main.2.ts b/public/docs/_examples/router-deprecated/ts/app/main.2.ts deleted file mode 100644 index 74862cdd0a..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/main.2.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* Second version */ -// For Milestone #2 -// Also includes digression on HashPathStrategy (not used in the final app) -// #docplaster - -// #docregion -import { bootstrap } from '@angular/platform-browser-dynamic'; -import { ROUTER_PROVIDERS } from '@angular/router-deprecated'; - -// Add these symbols to override the `LocationStrategy` -import { LocationStrategy, - HashLocationStrategy } from '@angular/common'; - -import { AppComponent } from './app.component'; -// #enddocregion -/* Can't use AppComponent ... but display as if we can -// #docregion - -bootstrap(AppComponent, [ -// #enddocregion -*/ - -// Actually use the v.2 component -import { AppComponent as ac } from './app.component.2'; - -bootstrap(ac, [ -// #docregion - ROUTER_PROVIDERS, - { provide: LocationStrategy, useClass: HashLocationStrategy } // .../#/crisis-center/ -]); -// #enddocregion diff --git a/public/docs/_examples/router-deprecated/ts/app/main.3.ts b/public/docs/_examples/router-deprecated/ts/app/main.3.ts deleted file mode 100644 index 9e9eb04721..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/main.3.ts +++ /dev/null @@ -1,7 +0,0 @@ -// #docregion -import { bootstrap } from '@angular/platform-browser-dynamic'; -import { ROUTER_PROVIDERS } from '@angular/router-deprecated'; - -import { AppComponent } from './app.component.3'; - -bootstrap(AppComponent, [ROUTER_PROVIDERS]); diff --git a/public/docs/_examples/router-deprecated/ts/app/main.ts b/public/docs/_examples/router-deprecated/ts/app/main.ts deleted file mode 100644 index 08bbbef6e8..0000000000 --- a/public/docs/_examples/router-deprecated/ts/app/main.ts +++ /dev/null @@ -1,7 +0,0 @@ -// #docregion -import { bootstrap } from '@angular/platform-browser-dynamic'; -import { ROUTER_PROVIDERS } from '@angular/router-deprecated'; - -import { AppComponent } from './app.component'; - -bootstrap(AppComponent, [ROUTER_PROVIDERS]); diff --git a/public/docs/_examples/router-deprecated/ts/example-config.json b/public/docs/_examples/router-deprecated/ts/example-config.json deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/public/docs/_examples/router-deprecated/ts/index.1.html b/public/docs/_examples/router-deprecated/ts/index.1.html deleted file mode 100644 index 53a6d4832f..0000000000 --- a/public/docs/_examples/router-deprecated/ts/index.1.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - Router (Deprecated) Sample v.1 - - - - - - - - - - - - - - - - -

Milestone 1

- loading... - - - - diff --git a/public/docs/_examples/router-deprecated/ts/index.2.html b/public/docs/_examples/router-deprecated/ts/index.2.html deleted file mode 100644 index d71bd929cb..0000000000 --- a/public/docs/_examples/router-deprecated/ts/index.2.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - Router (Deprecated) Sample v.2 - - - - - - - - - - - - - - - - -

Milestone 2

- loading... - - - - diff --git a/public/docs/_examples/router-deprecated/ts/index.3.html b/public/docs/_examples/router-deprecated/ts/index.3.html deleted file mode 100644 index abbb771beb..0000000000 --- a/public/docs/_examples/router-deprecated/ts/index.3.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - Router (Deprecated) Sample v.3 - - - - - - - - - - - - - - - - -

Milestone 3

- loading... - - - - diff --git a/public/docs/_examples/router-deprecated/ts/plnkr.json b/public/docs/_examples/router-deprecated/ts/plnkr.json deleted file mode 100644 index 91eff6fdb9..0000000000 --- a/public/docs/_examples/router-deprecated/ts/plnkr.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Router (Deprecated Beta)", - "files":[ - "!**/*.d.ts", - "!**/*.js", - "!**/*.[1,2,3].*", - "!app/crisis-list.component.ts", - "!app/hero-list.component.ts", - "!app/crisis-center/add-crisis.component.ts" - ], - "tags": ["router", "deprecated"] -} diff --git a/public/docs/_examples/router/e2e-spec.ts b/public/docs/_examples/router/e2e-spec.ts index bf672c3f01..a82ebd08a5 100644 --- a/public/docs/_examples/router/e2e-spec.ts +++ b/public/docs/_examples/router/e2e-spec.ts @@ -16,8 +16,8 @@ describe('Router', function () { crisisHref: hrefEles.get(0), crisisList: element.all(by.css('my-app > ng-component > ng-component li')), - crisisDetail: element(by.css('my-app > ng-component > ng-component > div')), - crisisDetailTitle: element(by.css('my-app > ng-component > ng-component > div > h3')), + crisisDetail: element(by.css('my-app > ng-component > ng-component > ng-component > div')), + crisisDetailTitle: element(by.css('my-app > ng-component > ng-component > ng-component > div > h3')), heroesHref: hrefEles.get(1), heroesList: element.all(by.css('my-app > ng-component li')), @@ -34,7 +34,7 @@ describe('Router', function () { expect(page.hrefs.count()).toEqual(4, 'should be 4 dashboard choices'); expect(page.crisisHref.getText()).toEqual('Crisis Center'); expect(page.heroesHref.getText()).toEqual('Heroes'); - expect(page.adminHref.getText()).toEqual('Crisis Admin'); + expect(page.adminHref.getText()).toEqual('Admin'); expect(page.loginHref.getText()).toEqual('Login'); }); @@ -118,7 +118,6 @@ describe('Router', function () { crisisText = text.substr(text.indexOf(' ')).trim(); return crisisEle.click(); }).then(function () { - expect(page.crisisList.count()).toBe(0, 'should no longer see crisis center entries'); expect(page.crisisDetail.isPresent()).toBe(true, 'should be able to see crisis detail'); expect(page.crisisDetailTitle.getText()).toContain(crisisText); let inputEle = page.crisisDetail.element(by.css('input')); diff --git a/public/docs/_examples/router/ts/app/admin/admin-dashboard.component.1.ts b/public/docs/_examples/router/ts/app/admin/admin-dashboard.component.1.ts new file mode 100644 index 0000000000..ffa3e3cb8f --- /dev/null +++ b/public/docs/_examples/router/ts/app/admin/admin-dashboard.component.1.ts @@ -0,0 +1,9 @@ +// #docregion +import { Component } from '@angular/core'; + +@Component({ + template: ` +

Dashboard

+ ` +}) +export class AdminDashboardComponent { } diff --git a/public/docs/_examples/router/ts/app/crisis-center/crisis-admin.component.ts b/public/docs/_examples/router/ts/app/admin/admin-dashboard.component.ts old mode 100755 new mode 100644 similarity index 86% rename from public/docs/_examples/router/ts/app/crisis-center/crisis-admin.component.ts rename to public/docs/_examples/router/ts/app/admin/admin-dashboard.component.ts index 38fe14a38e..8c8e481643 --- a/public/docs/_examples/router/ts/app/crisis-center/crisis-admin.component.ts +++ b/public/docs/_examples/router/ts/app/admin/admin-dashboard.component.ts @@ -6,15 +6,14 @@ import 'rxjs/add/operator/map'; @Component({ template: ` -

CRISIS ADMINISTRATION

-

Manage your crises here

+

Dashboard

Session ID: {{ sessionId | async }}

Token: {{ token | async }}

` }) -export class CrisisAdminComponent implements OnInit { +export class AdminDashboardComponent implements OnInit { sessionId: Observable; token: Observable; diff --git a/public/docs/_examples/router/ts/app/admin/admin.component.ts b/public/docs/_examples/router/ts/app/admin/admin.component.ts new file mode 100755 index 0000000000..30abfa4524 --- /dev/null +++ b/public/docs/_examples/router/ts/app/admin/admin.component.ts @@ -0,0 +1,17 @@ +// #docregion +import { Component } from '@angular/core'; + +@Component({ + template: ` +

ADMIN

+ + + ` +}) +export class AdminComponent { +} diff --git a/public/docs/_examples/router/ts/app/admin/admin.module.ts b/public/docs/_examples/router/ts/app/admin/admin.module.ts new file mode 100644 index 0000000000..dce2ce30e2 --- /dev/null +++ b/public/docs/_examples/router/ts/app/admin/admin.module.ts @@ -0,0 +1,28 @@ +// #docplaster +// #docregion +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { AdminComponent } from './admin.component'; +import { AdminDashboardComponent } from './admin-dashboard.component'; +import { ManageCrisesComponent } from './manage-crises.component'; +import { ManageHeroesComponent } from './manage-heroes.component'; + +import { adminRouting } from './admin.routing'; + +@NgModule({ + imports: [ + CommonModule, + adminRouting + ], + declarations: [ + AdminComponent, + AdminDashboardComponent, + ManageCrisesComponent, + ManageHeroesComponent + ] +}) +// #docregion admin-module-export +export class AdminModule {} +// #enddocregion admin-module-export +// #enddocregion diff --git a/public/docs/_examples/router/ts/app/admin/admin.routing.1.ts b/public/docs/_examples/router/ts/app/admin/admin.routing.1.ts new file mode 100644 index 0000000000..a620f3ba51 --- /dev/null +++ b/public/docs/_examples/router/ts/app/admin/admin.routing.1.ts @@ -0,0 +1,31 @@ +// #docplaster +// #docregion +import { ModuleWithProviders } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { AdminComponent } from './admin.component'; +import { AdminDashboardComponent } from './admin-dashboard.component'; +import { ManageCrisesComponent } from './manage-crises.component'; +import { ManageHeroesComponent } from './manage-heroes.component'; + +// #docregion admin-routes +const adminRoutes: Routes = [ + { + path: 'admin', + component: AdminComponent, + children: [ + { + path: '', + children: [ + { path: 'crises', component: ManageCrisesComponent }, + { path: 'heroes', component: ManageHeroesComponent }, + { path: '', component: AdminDashboardComponent } + ] + } + ] + } +]; + +export const adminRouting: ModuleWithProviders = RouterModule.forChild(adminRoutes); +// #enddocregion admin-routes +// #enddocregion diff --git a/public/docs/_examples/router/ts/app/admin/admin.routing.2.ts b/public/docs/_examples/router/ts/app/admin/admin.routing.2.ts new file mode 100644 index 0000000000..9fa3f10e4a --- /dev/null +++ b/public/docs/_examples/router/ts/app/admin/admin.routing.2.ts @@ -0,0 +1,37 @@ +// #docplaster +// #docregion +import { ModuleWithProviders } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { AdminComponent } from './admin.component'; +import { AdminDashboardComponent } from './admin-dashboard.component'; +import { ManageCrisesComponent } from './manage-crises.component'; +import { ManageHeroesComponent } from './manage-heroes.component'; + +// #docregion admin-route, can-activate-child +import { AuthGuard } from '../auth-guard.service'; + +const adminRoutes: Routes = [ + { + path: 'admin', + component: AdminComponent, + canActivate: [AuthGuard], + children: [ + { + path: '', + children: [ + { path: 'crises', component: ManageCrisesComponent }, + { path: 'heroes', component: ManageHeroesComponent }, + { path: '', component: AdminDashboardComponent } + ], + // #enddocregion admin-route + // #docregion can-activate-child + canActivateChild: [AuthGuard] + // #docregion admin-route + } + ] + } +]; + +export const adminRouting: ModuleWithProviders = RouterModule.forChild(adminRoutes); +// #enddocregion diff --git a/public/docs/_examples/router/ts/app/admin/admin.routing.3.ts b/public/docs/_examples/router/ts/app/admin/admin.routing.3.ts new file mode 100644 index 0000000000..3b4051a819 --- /dev/null +++ b/public/docs/_examples/router/ts/app/admin/admin.routing.3.ts @@ -0,0 +1,35 @@ +// #docplaster +// #docregion +import { ModuleWithProviders } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { AdminComponent } from './admin.component'; +import { AdminDashboardComponent } from './admin-dashboard.component'; +import { ManageCrisesComponent } from './manage-crises.component'; +import { ManageHeroesComponent } from './manage-heroes.component'; + +// #docregion admin-route +import { AuthGuard } from '../auth-guard.service'; + +// #docregion can-activate-child +const adminRoutes: Routes = [ + { + path: 'admin', + component: AdminComponent, + canActivate: [AuthGuard], + children: [ + { + path: '', + canActivateChild: [AuthGuard], + children: [ + { path: 'crises', component: ManageCrisesComponent }, + { path: 'heroes', component: ManageHeroesComponent }, + { path: '', component: AdminDashboardComponent } + ] + } + ] + } +]; + +export const adminRouting: ModuleWithProviders = RouterModule.forChild(adminRoutes); +// #enddocregion diff --git a/public/docs/_examples/router/ts/app/admin/admin.routing.ts b/public/docs/_examples/router/ts/app/admin/admin.routing.ts new file mode 100644 index 0000000000..bc5d13554c --- /dev/null +++ b/public/docs/_examples/router/ts/app/admin/admin.routing.ts @@ -0,0 +1,34 @@ +// #docplaster +// #docregion +import { ModuleWithProviders } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { AdminComponent } from './admin.component'; +import { AdminDashboardComponent } from './admin-dashboard.component'; +import { ManageCrisesComponent } from './manage-crises.component'; +import { ManageHeroesComponent } from './manage-heroes.component'; + +// #docregion admin-route +import { AuthGuard } from '../auth-guard.service'; + +const adminRoutes: Routes = [ + { + path: '', + component: AdminComponent, + canActivate: [AuthGuard], + children: [ + { + path: '', + canActivateChild: [AuthGuard], + children: [ + { path: 'crises', component: ManageCrisesComponent }, + { path: 'heroes', component: ManageHeroesComponent }, + { path: '', component: AdminDashboardComponent } + ] + } + ] + } +]; + +export const adminRouting: ModuleWithProviders = RouterModule.forChild(adminRoutes); +// #enddocregion diff --git a/public/docs/_examples/router/ts/app/crisis-center/crisis-admin.component.1.ts b/public/docs/_examples/router/ts/app/admin/manage-crises.component.ts similarity index 63% rename from public/docs/_examples/router/ts/app/crisis-center/crisis-admin.component.1.ts rename to public/docs/_examples/router/ts/app/admin/manage-crises.component.ts index a8dacc8549..d3176563eb 100644 --- a/public/docs/_examples/router/ts/app/crisis-center/crisis-admin.component.1.ts +++ b/public/docs/_examples/router/ts/app/admin/manage-crises.component.ts @@ -3,8 +3,7 @@ import { Component } from '@angular/core'; @Component({ template: ` -

CRISIS ADMINISTRATION

Manage your crises here

` }) -export class CrisisAdminComponent { } +export class ManageCrisesComponent { } diff --git a/public/docs/_examples/router/ts/app/admin/manage-heroes.component.ts b/public/docs/_examples/router/ts/app/admin/manage-heroes.component.ts new file mode 100644 index 0000000000..7f3a39893d --- /dev/null +++ b/public/docs/_examples/router/ts/app/admin/manage-heroes.component.ts @@ -0,0 +1,9 @@ +// #docregion +import { Component } from '@angular/core'; + +@Component({ + template: ` +

Manage your heroes here

+ ` +}) +export class ManageHeroesComponent { } diff --git a/public/docs/_examples/router/ts/app/app.component.1.ts b/public/docs/_examples/router/ts/app/app.component.1.ts index 1b0aba0044..21e9aa417d 100644 --- a/public/docs/_examples/router/ts/app/app.component.1.ts +++ b/public/docs/_examples/router/ts/app/app.component.1.ts @@ -6,7 +6,7 @@ import { Component } from '@angular/core'; selector: 'my-app', // #docregion template template: ` -

Component Router

+

Angular Router