diff --git a/public/docs/_examples/cb-dependency-injection/ts/app/hero.service.ts b/public/docs/_examples/cb-dependency-injection/ts/app/hero.service.ts index 9a7bdccd02..2063c30d7a 100644 --- a/public/docs/_examples/cb-dependency-injection/ts/app/hero.service.ts +++ b/public/docs/_examples/cb-dependency-injection/ts/app/hero.service.ts @@ -13,7 +13,7 @@ export class HeroService { ]; getHeroById(id: number): Hero { - return this.heroes.filter(hero => hero.id === id)[0]; + return this.heroes.find(hero => hero.id === id); } getAllHeroes(): Array { 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 index 1200e8ac31..a847a15217 100644 --- 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 @@ -21,7 +21,7 @@ export class CrisisService { getCrisis(id: number | string) { return crisesPromise - .then(crises => crises.filter(c => c.id === +id)[0]); + .then(crises => crises.find(c => c.id === +id)); } // #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 index c2aec9807e..c819bd2632 100644 --- a/public/docs/_examples/router-deprecated/ts/app/heroes/hero.service.ts +++ b/public/docs/_examples/router-deprecated/ts/app/heroes/hero.service.ts @@ -22,6 +22,6 @@ export class HeroService { getHero(id: number | string) { return heroesPromise - .then(heroes => heroes.filter(h => h.id === +id)[0]); + .then(heroes => heroes.find(h => h.id === +id)); } } diff --git a/public/docs/_examples/router/ts/app/crisis-center/crisis.service.ts b/public/docs/_examples/router/ts/app/crisis-center/crisis.service.ts index 20597752cc..b5d9e282c0 100644 --- a/public/docs/_examples/router/ts/app/crisis-center/crisis.service.ts +++ b/public/docs/_examples/router/ts/app/crisis-center/crisis.service.ts @@ -25,7 +25,7 @@ export class CrisisService { getCrisis(id: number | string) { return crisesPromise - .then(crises => crises.filter(c => c.id === +id)[0]); + .then(crises => crises.find(crisis => crisis.id === +id)); } // #enddocregion diff --git a/public/docs/_examples/router/ts/app/heroes/hero.service.ts b/public/docs/_examples/router/ts/app/heroes/hero.service.ts index c2aec9807e..6e4e7bee60 100644 --- a/public/docs/_examples/router/ts/app/heroes/hero.service.ts +++ b/public/docs/_examples/router/ts/app/heroes/hero.service.ts @@ -22,6 +22,6 @@ export class HeroService { getHero(id: number | string) { return heroesPromise - .then(heroes => heroes.filter(h => h.id === +id)[0]); + .then(heroes => heroes.find(hero => hero.id === +id)); } } diff --git a/public/docs/_examples/testing/ts/app/hero.service.ts b/public/docs/_examples/testing/ts/app/hero.service.ts index f83588934b..e9473e4038 100644 --- a/public/docs/_examples/testing/ts/app/hero.service.ts +++ b/public/docs/_examples/testing/ts/app/hero.service.ts @@ -20,7 +20,7 @@ export class HeroService { // #docregion get-hero getHero(id: number) { return Promise.resolve(HEROES).then( - heroes => heroes.filter(hero => hero.id === id)[0] + heroes => heroes.find(hero => hero.id === id) ); } // #enddocregion get-hero diff --git a/public/docs/_examples/toh-5/ts/app/hero.service.ts b/public/docs/_examples/toh-5/ts/app/hero.service.ts index c1cb8fa3e6..900d0da712 100644 --- a/public/docs/_examples/toh-5/ts/app/hero.service.ts +++ b/public/docs/_examples/toh-5/ts/app/hero.service.ts @@ -20,7 +20,7 @@ export class HeroService { // #docregion get-hero getHero(id: number) { return this.getHeroes() - .then(heroes => heroes.filter(hero => hero.id === id)[0]); + .then(heroes => heroes.find(hero => hero.id === id)); } // #enddocregion get-hero } diff --git a/public/docs/_examples/toh-6/ts/app/hero.service.ts b/public/docs/_examples/toh-6/ts/app/hero.service.ts index 8995a3dd96..a2344d84e6 100644 --- a/public/docs/_examples/toh-6/ts/app/hero.service.ts +++ b/public/docs/_examples/toh-6/ts/app/hero.service.ts @@ -33,7 +33,7 @@ export class HeroService { getHero(id: number) { return this.getHeroes() - .then(heroes => heroes.filter(hero => hero.id === id)[0]); + .then(heroes => heroes.find(hero => hero.id === id)); } // #docregion save