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

chore(ts): updating to beta.16 #1178

Merged
merged 1 commit into from
Apr 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions public/docs/_examples/cb-dependency-injection/ts/app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { bootstrap } from 'angular2/platform/browser';
import { provide } from 'angular2/core';
import { XHRBackend } from 'angular2/http';

import { ROUTER_PROVIDERS } from 'angular2/router';

import { LocationStrategy,
HashLocationStrategy,
ROUTER_PROVIDERS } from 'angular2/router';
HashLocationStrategy } from 'angular2/platform/common';

import { HeroData } from './hero-data';
import { InMemoryBackendService,
Expand Down
4 changes: 3 additions & 1 deletion public/docs/_examples/cb-ts-to-js/ts/app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import {provide}
from 'angular2/core';
import {bootstrap}
from 'angular2/platform/browser';
import {
} from 'angular2/router';
import {
LocationStrategy,
HashLocationStrategy
} from 'angular2/router';
} from 'angular2/platform/common';
// #enddocregion ng2import

// #docregion appimport
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// #docplaster
//#docregion
import { Injector } from 'angular2/core';
import { ReflectiveInjector } from 'angular2/core';

import {Car, Engine, Tires} from './car';
import {Logger} from '../logger.service';

//#docregion injector
export function useInjector() {
var injector:Injector;
var injector:ReflectiveInjector;

//#enddocregion injector
/*
//#docregion injector-no-new
// Cannot 'new' an Injector like this!
var injector = new Injector([Car, Engine, Tires, Logger]);
// Cannot 'new' an ReflectiveInjector like this!
var injector = new ReflectiveInjector([Car, Engine, Tires, Logger]);
//#enddocregion injector-no-new
*/

//#docregion injector
//#docregion injector-create-and-call
injector = Injector.resolveAndCreate([Car, Engine, Tires, Logger]);
injector = ReflectiveInjector.resolveAndCreate([Car, Engine, Tires, Logger]);
//#docregion injector-call
var car = injector.get(Car);
//#enddocregion injector-call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class InjectorComponent {
hero = this.heroService.getHeroes()[0];

get rodent() {
let rous = this._injector.getOptional(ROUS);
let rous = this._injector.get(ROUS, null);
if (rous) {
throw new Error('Aaaargh!')
}
Expand Down
6 changes: 3 additions & 3 deletions public/docs/_examples/homepage-hello-world/ts/index.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

<script src="https://code.angularjs.org/tools/system.js"></script>
<script src="https://code.angularjs.org/tools/typescript.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.15/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.15/Rx.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.15/angular2.dev.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.16/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.16/Rx.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.16/angular2.dev.js"></script>

<!-- 2. Configure SystemJS -->
<script>
Expand Down
6 changes: 3 additions & 3 deletions public/docs/_examples/homepage-tabs/ts/index.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

<script src="https://code.angularjs.org/tools/system.js"></script>
<script src="https://code.angularjs.org/tools/typescript.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.15/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.15/Rx.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.15/angular2.dev.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.16/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.16/Rx.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.16/angular2.dev.js"></script>

<!-- 2. Configure SystemJS -->
<script>
Expand Down
6 changes: 3 additions & 3 deletions public/docs/_examples/homepage-todo/ts/index.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

<script src="https://code.angularjs.org/tools/system.js"></script>
<script src="https://code.angularjs.org/tools/typescript.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.15/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.15/Rx.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.15/angular2.dev.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.16/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.16/Rx.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.16/angular2.dev.js"></script>

<!-- 2. Configure SystemJS -->
<script>
Expand Down
13 changes: 6 additions & 7 deletions public/docs/_examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,21 @@
"author": "",
"license": "ISC",
"dependencies": {
"angular2": "2.0.0-beta.15",
"angular2": "2.0.0-beta.16",
"systemjs": "0.19.26",
"es6-shim": "^0.35.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"zone.js": "0.6.10",
"zone.js": "^0.6.12",

"a2-in-memory-web-api": "^0.1.15",
"a2-in-memory-web-api": "^0.1.16",
"bootstrap": "^3.3.6"

},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings":"^0.7.12",
"typings": "^0.8.1",

"canonical-path": "0.0.2",
"http-server": "^0.9.0",
Expand All @@ -44,8 +43,8 @@
"karma-cli": "^0.1.2",
"karma-htmlfile-reporter": "^0.2.2",
"karma-jasmine": "^0.3.8",
"protractor": "^3.2.2",
"protractor": "^3.3.0",
"rimraf": "^2.5.2"
},
"repository": { }
"repository": {}
}
5 changes: 0 additions & 5 deletions public/docs/_examples/pipes/ts/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ <h1>Pipes</h1>
<a href="#flying-heroes-impure">Flying Heroes filter pipe (impure)</a><br>
<a href="#hero-message">Async Hero Message and AsyncPipe</a><br>
<a href="#hero-list">Hero List with caching FetchJsonPipe</a><br>
<a href="#random-pipe">Random Pipe (pure pipe / impure function)</a><br>


<hr>
Expand Down Expand Up @@ -81,8 +80,4 @@ <h2>Birthday Pipe Chaining</h2>
<a id="hero-list"></a>
<hero-list></hero-list>

<hr>
<a id="random-pipe"></a>
<random-pipe></random-pipe>

<div style="margin-top:12em;"></div>
4 changes: 1 addition & 3 deletions public/docs/_examples/pipes/ts/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {HeroBirthday2} from './hero-birthday2.component';
import {HeroListComponent} from './hero-list.component';
import {PowerBooster} from './power-booster.component';
import {PowerBoostCalculator} from './power-boost-calculator.component';
import {RandomPipeComponent} from './random-pipe.component';

@Component({
selector: 'my-app',
Expand All @@ -21,8 +20,7 @@ import {RandomPipeComponent} from './random-pipe.component';
HeroBirthday,
HeroBirthday2,
HeroListComponent,
PowerBooster, PowerBoostCalculator,
RandomPipeComponent
PowerBooster, PowerBoostCalculator
],
providers:[HTTP_PROVIDERS]
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {Pipe, PipeTransform} from 'angular2/core';
*/
@Pipe({name: 'exponentialStrength'})
export class ExponentialStrengthPipe implements PipeTransform {
transform(value:number, [exponent]) : number {
var exp = parseFloat(exponent);
transform(value: number, exponent: string): number {
let exp = parseFloat(exponent);
return Math.pow(value, isNaN(exp) ? 1 : exp);
}
}
4 changes: 2 additions & 2 deletions public/docs/_examples/pipes/ts/app/fetch-json.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export class FetchJsonPipe implements PipeTransform{

constructor(private _http: Http) { }

transform(url:string):any {
transform(url: string): any {
if (url !== this.prevUrl) {
this.prevUrl = url;
this.fetched = null;
this._http.get(url)
.map( result => result.json() )
.subscribe( result => this.fetched = result )
.subscribe( result => this.fetched = result );
}

return this.fetched;
Expand Down
24 changes: 0 additions & 24 deletions public/docs/_examples/pipes/ts/app/random-pipe.component.ts

This file was deleted.

4 changes: 2 additions & 2 deletions public/docs/_examples/quickstart/js/package.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
},
"license": "ISC",
"dependencies": {
"angular2": "2.0.0-beta.15",
"angular2": "2.0.0-beta.16",
"es6-shim": "^0.35.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"zone.js": "0.6.10"
"zone.js": "0.6.12"
},
"devDependencies": {
"concurrently": "^2.0.0",
Expand Down
6 changes: 3 additions & 3 deletions public/docs/_examples/quickstart/ts/package.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
},
"license": "ISC",
"dependencies": {
"angular2": "2.0.0-beta.15",
"angular2": "2.0.0-beta.16",
"systemjs": "0.19.26",
"es6-shim": "^0.35.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"zone.js": "0.6.10"
"zone.js": "0.6.12"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings":"^0.7.12"
"typings":"^0.8.1"
}
}
2 changes: 1 addition & 1 deletion public/docs/_examples/router/ts/app/main.2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {AppComponent} from './app.component';
// Add these symbols to override the `LocationStrategy`
import {provide} from 'angular2/core';
import {LocationStrategy,
HashLocationStrategy} from 'angular2/router';
HashLocationStrategy} from 'angular2/platform/common';
// #enddocregion
/* Can't use AppComponent ... but display as if we can
// #docregion
Expand Down
6 changes: 3 additions & 3 deletions public/docs/_examples/testing/ts/app/mock-router.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from 'angular2/router';

import { Directive, DynamicComponentLoader, ElementRef,
import { Directive, DynamicComponentLoader, ViewContainerRef,
Injectable, Optional, Input } from 'angular2/core';

import { PromiseWrapper } from 'angular2/src/facade/promise';
Expand Down Expand Up @@ -52,11 +52,11 @@ export class MockRouterOutlet extends RouterOutlet {
name: string = null;

constructor(
_elementRef: ElementRef,
_viewContainerRef: ViewContainerRef,
@Optional() _loader: DynamicComponentLoader,
_parentRouter: Router,
nameAttr: string) {
super(_elementRef, _loader, _parentRouter, nameAttr);
super(_viewContainerRef, _loader, _parentRouter, nameAttr);
if (nameAttr) {
this.name = nameAttr;
}
Expand Down
2 changes: 1 addition & 1 deletion public/docs/js/latest/_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"icon": "home",
"title": "Angular Docs",
"menuTitle": "Docs Home",
"banner": "Welcome to <b>Angular in JavaScript</b>! The current Angular 2 release is <b>beta.15</b>. Please consult the <a href='https://github.com/angular/angular/blob/master/CHANGELOG.md' target='_blank'> Change Log</a> about recent enhancements, fixes, and breaking changes."
"banner": "Welcome to <b>Angular in JavaScript</b>! The current Angular 2 release is <b>beta.16</b>. Please consult the <a href='https://github.com/angular/angular/blob/master/CHANGELOG.md' target='_blank'> Change Log</a> about recent enhancements, fixes, and breaking changes."
},

"quickstart": {
Expand Down
2 changes: 1 addition & 1 deletion public/docs/ts/latest/_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"icon": "home",
"title": "Angular Docs",
"menuTitle": "Docs Home",
"banner": "Welcome to <b>Angular in TypeScript</b>! The current Angular 2 release is <b>beta.15</b>. Please consult the <a href='https://github.com/angular/angular/blob/master/CHANGELOG.md' target='_blank'> Change Log</a> about recent enhancements, fixes, and breaking changes."
"banner": "Welcome to <b>Angular in TypeScript</b>! The current Angular 2 release is <b>beta.16</b>. Please consult the <a href='https://github.com/angular/angular/blob/master/CHANGELOG.md' target='_blank'> Change Log</a> about recent enhancements, fixes, and breaking changes."
},

"quickstart": {
Expand Down
3 changes: 2 additions & 1 deletion public/docs/ts/latest/guide/dependency-injection.jade
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,8 @@ p.
They are retrieved by calling `injector.get`.

The `get` method throws an error if it can't resolve the requested service.
We can call `getOptional` instead, which we do in one case
We can call `get` with a second parameter (the value to return if the service is not found)
instead, which we do in one case
to retrieve a service (`ROUS`) that isn't registered with this or any ancestor injector.

.l-sub-section
Expand Down
21 changes: 4 additions & 17 deletions public/docs/ts/latest/guide/pipes.jade
Original file line number Diff line number Diff line change
Expand Up @@ -386,33 +386,21 @@ figure.image-display

a(id="pure-pipe-pure-fn")
:marked
### Pure pipes vs. pure functions
### Pure pipes and pure functions

When developers first hear of *pure pipes* many of them think these pipes must be *pure functions*.
A pure pipe uses pure functions.

Pure functions process inputs and return values without detectable side-effects.
Given the same input they should always return the same output.

Pure pipes _are_ typically implemented with pure function.
The pipes we saw earlier in this chapter were implemented with pure functions.
The built-in `DatePipe` is a pure pipe with a pure function implementation.
So is our `ExponentialStrengthPipe`.
So is our `FlyingHeroesPipe`.

But there is no necessary connection between a pure pipe and a pure function.
A few steps back we reviewed the `FlyingHeroesImpurePipe` &mdash; *an impure pipe with a pure function*.

We can also write *a pure pipe with an impure function* such as the
`RandomizerPipe` (also in the [live example](/resources/live-examples/pipes/ts/plnkr.html))
that ignores its input value and outputs a random number. Clearly an impure function!
Yet it's perfectly well behaved as a pure pipe.
+makeExample('pipes/ts/app/random-pipe.component.ts', 'pipe','app/random-pipe.component.ts (pipe)')(format='.')
:marked
When the input changes, it outputs a new value albeit never the same value for the same input.

Remember *purity in a pipe has nothing to do with pure functions!*

*Pipe purity* is more about the purity of the input values than of the pipe itself.

But a *pure pipe* must always be implemented with a *pure function*. Failure to heed this warning will bring about many a console errors regarding expressions that have changed after they were checked.

.l-main-section
:marked
Expand Down Expand Up @@ -471,4 +459,3 @@ code-example(format="." language="html")

If these performance and minification considerations do not apply to you, you can always create your own such pipes
(along the lines of the [FlyingHeroesPipe](#impure-flying-heroes)) or find them in the community.

Loading