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

Commit 691b13c

Browse files
committed
chore(ts): updating to beta.16
WIP - DO NOT MERGE Examples still broken: - pipes
1 parent 8a49b4a commit 691b13c

File tree

12 files changed

+27
-68
lines changed

12 files changed

+27
-68
lines changed

public/docs/_examples/cb-dependency-injection/ts/app/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import { bootstrap } from 'angular2/platform/browser';
33
import { provide } from 'angular2/core';
44
import { XHRBackend } from 'angular2/http';
55

6+
import { ROUTER_PROVIDERS } from 'angular2/router';
7+
68
import { LocationStrategy,
7-
HashLocationStrategy,
8-
ROUTER_PROVIDERS } from 'angular2/router';
9+
HashLocationStrategy } from 'angular2/platform/common';
910

1011
import { HeroData } from './hero-data';
1112
import { InMemoryBackendService,

public/docs/_examples/cb-ts-to-js/ts/app/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import {provide}
33
from 'angular2/core';
44
import {bootstrap}
55
from 'angular2/platform/browser';
6+
import {
7+
} from 'angular2/router';
68
import {
79
LocationStrategy,
810
HashLocationStrategy
9-
} from 'angular2/router';
11+
} from 'angular2/platform/common';
1012
// #enddocregion ng2import
1113

1214
// #docregion appimport

public/docs/_examples/dependency-injection/ts/app/car/car-injector.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
// #docplaster
22
//#docregion
3-
import { Injector } from 'angular2/core';
3+
import { ReflectiveInjector } from 'angular2/core';
44

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

88
//#docregion injector
99
export function useInjector() {
10-
var injector:Injector;
10+
var injector:ReflectiveInjector;
1111

1212
//#enddocregion injector
1313
/*
1414
//#docregion injector-no-new
15-
// Cannot 'new' an Injector like this!
16-
var injector = new Injector([Car, Engine, Tires, Logger]);
15+
// Cannot 'new' an ReflectiveInjector like this!
16+
var injector = new ReflectiveInjector([Car, Engine, Tires, Logger]);
1717
//#enddocregion injector-no-new
1818
*/
1919

2020
//#docregion injector
2121
//#docregion injector-create-and-call
22-
injector = Injector.resolveAndCreate([Car, Engine, Tires, Logger]);
22+
injector = ReflectiveInjector.resolveAndCreate([Car, Engine, Tires, Logger]);
2323
//#docregion injector-call
2424
var car = injector.get(Car);
2525
//#enddocregion injector-call

public/docs/_examples/dependency-injection/ts/app/injector.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class InjectorComponent {
3030
hero = this.heroService.getHeroes()[0];
3131

3232
get rodent() {
33-
let rous = this._injector.getOptional(ROUS);
33+
let rous = this._injector.get(ROUS, null);
3434
if (rous) {
3535
throw new Error('Aaaargh!')
3636
}

public/docs/_examples/package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,22 @@
2020
"author": "",
2121
"license": "ISC",
2222
"dependencies": {
23-
"angular2": "2.0.0-beta.15",
23+
"angular2": "angular/angular#2.0.0-build.cc86fee.js",
2424
"systemjs": "0.19.26",
25+
2526
"es6-shim": "^0.35.0",
2627
"reflect-metadata": "0.1.2",
2728
"rxjs": "5.0.0-beta.2",
28-
"zone.js": "0.6.10",
29+
"zone.js": "^0.6.11",
2930

3031
"a2-in-memory-web-api": "^0.1.15",
3132
"bootstrap": "^3.3.6"
32-
3333
},
3434
"devDependencies": {
3535
"concurrently": "^2.0.0",
3636
"lite-server": "^2.2.0",
37-
"typescript": "^1.8.10",
38-
"typings":"^0.7.12",
39-
37+
"typescript": "^1.9.0-dev.20160409",
38+
"typings": "^0.7.12",
4039
"http-server": "^0.9.0",
4140
"jasmine-core": "~2.4.1",
4241
"karma": "^0.13.22",
@@ -48,5 +47,5 @@
4847
"protractor": "^3.2.2",
4948
"rimraf": "^2.5.2"
5049
},
51-
"repository": { }
50+
"repository": {}
5251
}

public/docs/_examples/pipes/ts/app/app.component.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ <h1>Pipes</h1>
1010
<a href="#flying-heroes-impure">Flying Heroes filter pipe (impure)</a><br>
1111
<a href="#hero-message">Async Hero Message and AsyncPipe</a><br>
1212
<a href="#hero-list">Hero List with caching FetchJsonPipe</a><br>
13-
<a href="#random-pipe">Random Pipe (pure pipe / impure function)</a><br>
1413

1514

1615
<hr>
@@ -81,8 +80,4 @@ <h2>Birthday Pipe Chaining</h2>
8180
<a id="hero-list"></a>
8281
<hero-list></hero-list>
8382

84-
<hr>
85-
<a id="random-pipe"></a>
86-
<random-pipe></random-pipe>
87-
8883
<div style="margin-top:12em;"></div>

public/docs/_examples/pipes/ts/app/app.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {HeroBirthday2} from './hero-birthday2.component';
1010
import {HeroListComponent} from './hero-list.component';
1111
import {PowerBooster} from './power-booster.component';
1212
import {PowerBoostCalculator} from './power-boost-calculator.component';
13-
import {RandomPipeComponent} from './random-pipe.component';
1413

1514
@Component({
1615
selector: 'my-app',
@@ -21,8 +20,7 @@ import {RandomPipeComponent} from './random-pipe.component';
2120
HeroBirthday,
2221
HeroBirthday2,
2322
HeroListComponent,
24-
PowerBooster, PowerBoostCalculator,
25-
RandomPipeComponent
23+
PowerBooster, PowerBoostCalculator
2624
],
2725
providers:[HTTP_PROVIDERS]
2826
})

public/docs/_examples/pipes/ts/app/exponential-strength.pipe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {Pipe, PipeTransform} from 'angular2/core';
1111
*/
1212
@Pipe({name: 'exponentialStrength'})
1313
export class ExponentialStrengthPipe implements PipeTransform {
14-
transform(value:number, [exponent]) : number {
14+
transform(value:number, [exponent]:string[]) : number {
1515
var exp = parseFloat(exponent);
1616
return Math.pow(value, isNaN(exp) ? 1 : exp);
1717
}

public/docs/_examples/pipes/ts/app/random-pipe.component.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

public/docs/_examples/router/ts/app/main.2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {AppComponent} from './app.component';
1111
// Add these symbols to override the `LocationStrategy`
1212
import {provide} from 'angular2/core';
1313
import {LocationStrategy,
14-
HashLocationStrategy} from 'angular2/router';
14+
HashLocationStrategy} from 'angular2/platform/common';
1515
// #enddocregion
1616
/* Can't use AppComponent ... but display as if we can
1717
// #docregion

public/docs/ts/latest/guide/dependency-injection.jade

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,8 @@ p.
871871
They are retrieved by calling `injector.get`.
872872

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

877878
.l-sub-section

public/docs/ts/latest/guide/pipes.jade

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -386,33 +386,21 @@ figure.image-display
386386

387387
a(id="pure-pipe-pure-fn")
388388
:marked
389-
### Pure pipes vs. pure functions
389+
### Pure pipes and pure functions
390390

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

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

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

402-
But there is no necessary connection between a pure pipe and a pure function.
403401
A few steps back we reviewed the `FlyingHeroesImpurePipe` &mdash; *an impure pipe with a pure function*.
404-
405-
We can also write *a pure pipe with an impure function* such as the
406-
`RandomizerPipe` (also in the [live example](/resources/live-examples/pipes/ts/plnkr.html))
407-
that ignores its input value and outputs a random number. Clearly an impure function!
408-
Yet it's perfectly well behaved as a pure pipe.
409-
+makeExample('pipes/ts/app/random-pipe.component.ts', 'pipe','app/random-pipe.component.ts (pipe)')(format='.')
410-
:marked
411-
When the input changes, it outputs a new value albeit never the same value for the same input.
412-
413-
Remember *purity in a pipe has nothing to do with pure functions!*
414-
415-
*Pipe purity* is more about the purity of the input values than of the pipe itself.
402+
403+
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.
416404

417405
.l-main-section
418406
:marked
@@ -471,4 +459,3 @@ code-example(format="." language="html")
471459

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

0 commit comments

Comments
 (0)