Skip to content

Commit

Permalink
docs: Add more information on contributing and API docs (#283)
Browse files Browse the repository at this point in the history
Closes #263, #274, #279
  • Loading branch information
brandonroberts authored and MikeRyanDev committed Aug 17, 2017
1 parent b42ba97 commit 090462a
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 13 deletions.
28 changes: 24 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,46 @@
npm install
```

OR
```
yarn
```

### Testing

```
npm test
```

OR

```
yarn test
```

## Submitting Pull Requests

**Please follow these basic steps to simplify pull request reviews - if you don't you'll probably just be asked to anyway.**

* Please rebase your branch against the current master
* Run ```npm install``` to make sure your development dependencies are up-to-date
* Run the `Setup` command to make sure your development dependencies are up-to-date
* Please ensure the test suite passes before submitting a PR
* If you've added new functionality, **please** include tests which validate its behavior
* Make reference to possible [issues](https://github.com/ngrx/platform/issues) on PR comment

## Submitting bug reports

* Please detail the affected browser(s) and operating system(s)
* Please be sure to state which version of node **and** npm you're using
* Search through issues to see if a previous issue has already been reported and/or fixed.
* Provide a _small_ reproduction using a [plunker template](http://plnkr.co/edit/tpl:757r6L?p=preview) or github repo.
* Please detail the affected browser(s) and operating system(s).
* Please be sure to state which version of Angular, node and npm you're using.

## Submitting New features

* We value keeping the API surface small and concise, which factors into whether new features are accepted.
* Submit an issue with the prefix `RFC: ` with your feature request.
* The feature will be discussed and considered.
* Once the PR is submitted, it will be reviewed and merged once approved.


## Financial contributions
Expand Down Expand Up @@ -63,4 +83,4 @@ Thank you to all our sponsors! (please ask your company to also support this ope
<a href="https://opencollective.com/ngrx/sponsor/6/website" target="_blank"><img src="https://opencollective.com/ngrx/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/ngrx/sponsor/7/website" target="_blank"><img src="https://opencollective.com/ngrx/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/ngrx/sponsor/8/website" target="_blank"><img src="https://opencollective.com/ngrx/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/ngrx/sponsor/9/website" target="_blank"><img src="https://opencollective.com/ngrx/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/ngrx/sponsor/9/website" target="_blank"><img src="https://opencollective.com/ngrx/sponsor/9/avatar.svg"></a>
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Reactive libraries for Angular
- [@ngrx/store-devtools](./docs/store-devtools/README.md) - Store instrumentation that enables a
[powerful time-travelling debugger](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd?hl=en).

## Examples
- [example-app](./example-app/README.md) - Example application utilizing @ngrx libraries, showcasing common patterns and best practices.

## Migration
- [Migration guide](./MIGRATION.md) for users of ngrx packages prior to 4.x.

Expand Down
16 changes: 11 additions & 5 deletions docs/store/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function getInitialState() {
configuration option to provide an array of meta-reducers that are composed from right to left.

```ts
import { StoreModule, ActionReducer } from '@ngrx/store';
import { StoreModule, ActionReducer, MetaReducer } from '@ngrx/store';
import { reducers } from './reducers';

// console.log all actions
Expand All @@ -62,7 +62,7 @@ export function debug(reducer: ActionReducer<any>): ActionReducer<any> {
}
}

export const metaReducers = [debug];
export const metaReducers: MetaReducer<any> = [debug];

@NgModule({
imports: [
Expand All @@ -81,17 +81,23 @@ and `metaReducers` configuration options are available.

```ts
// feature.module.ts
import { StoreModule } from '@ngrx/store';
import { reducers } from './reducers';
import { StoreModule, ActionReducerMap } from '@ngrx/store';

export const reducers: ActionReducerMap<any> = {
subFeatureA: featureAReducer,
subFeatureB: featureBReducer,
};

@NgModule({
imports: [
StoreModule.forFeature('featureName', reducers, { })
StoreModule.forFeature('featureName', reducers)
]
})
export class FeatureModule {}
```

The feature state is added to the global application state once the feature is loaded. The feature state can then be selected using the [./selectors.md#createFeatureSelector](createFeatureSelector) convenience method.

## Injecting Reducers

To inject the root reducers into your application, use an `InjectionToken` and a `Provider` to register the reducers through dependency injection.
Expand Down
2 changes: 1 addition & 1 deletion docs/store/selectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MyAppComponent {

## createFeatureSelector

The `createFeatureSelector` methods returns a selector function for a feature slice of state.
The `createFeatureSelector` is a convenience method for returning a top level feature state. It returns a typed selector function for a feature slice of state.

### Example

Expand Down
5 changes: 4 additions & 1 deletion example-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ npm install
yarn

# start the server
npm run example:start
npm run build && npm run cli -- serve

# OR
yarn run example:start
```

Navigate to [http://localhost:4200/](http://localhost:4200/) in your browser
Expand Down
4 changes: 2 additions & 2 deletions example-app/app/auth/components/login-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ export class LoginFormComponent implements OnInit {
set pending(isPending: boolean) {
if (isPending) {
this.form.disable();
} else {
this.form.enable();
}

this.form.enable();
}

@Input() errorMessage: string | null;
Expand Down

0 comments on commit 090462a

Please sign in to comment.