Skip to content

Commit

Permalink
docs(store): remove deprecated store.select() (#1315)
Browse files Browse the repository at this point in the history
Closes #1313
  • Loading branch information
peterbsmyth authored and brandonroberts committed Aug 31, 2018
1 parent 695bd20 commit 9706879
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
4 changes: 2 additions & 2 deletions docs/store/downgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ state, you will need to downgrade the Store service to use it in the AngularJS
parts of your application.

```ts
import { Store } from '@ngrx/store';
import { Store, select } from '@ngrx/store';
import { downgradeInjectable } from '@angular/upgrade/static';
import { module as ngModule } from 'angular';
// app
Expand All @@ -28,7 +28,7 @@ export default ngModule('appName').controller('AngularJSController', [
function($scope, $controller, ngrxStoreService) {
// ...
ngrxStoreService.dispatch(new MyActionClass(myPayload));
ngrxStoreService.select(mySelectorFunction).subscribe(/*...*/);
ngrxStoreService.pipe(select(mySelectorFunction)).subscribe(/*...*/);
// ...
},
]);
Expand Down
16 changes: 2 additions & 14 deletions docs/store/selectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,23 +280,11 @@ This section covers some basics of how selectors compare to pipeable operators a

### Breaking Down the Basics

#### Step 1: Select a non-empty state
#### Select a non-empty state using pipeable operators

Let's pretend we have a selector called `selectValues` and the component for displaying the data is only interested in defined values, i.e., it should not display empty states.
The straight-forward solution is to apply the RxJS `filter` operator to the `Observable` returned by `store.select()`:

```ts
import { filter } from 'rxjs/operators';

store
.select(selectValues)
.pipe(filter(val => val !== undefined))
.subscribe(/* .. */);
```

#### Step 2: Refactoring to pipeable operators

The same behaviour can be achieved by re-writing the above piece of code to use only RxJS pipeable operators instead of the `store.select()` function:
We can achieve this behaviour by using only RxJS pipeable operators:

```ts
import { map, filter } from 'rxjs/operators';
Expand Down
2 changes: 1 addition & 1 deletion docs/store/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { counter } from './counter';
export class AppModule {}
```

You can then inject the `Store` service into your components and services. Use `store.select` to
You can then inject the `Store` service into your components and services. Use `select` to
_select_ slice(s) of state:

```ts
Expand Down

0 comments on commit 9706879

Please sign in to comment.