Skip to content
Merged
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
23 changes: 23 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,29 @@ import { JsonApiModule } from 'angular2-jsonapi';
export class AppModule { }
```

### Angular CLI configuration (for CLI 8.1+)

Beginning from Angular CLI 8.1 the `tsconfig.json` does not sets the `emitDecoratorMetadata` option (see https://blog.ninja-squad.com/2019/07/03/angular-cli-8.1/#typescript-configuration-changes). But we need it to read the metadata from the models. So make sure to update your `tsconfig.json`:

```json
{
"compilerOptions": {
"emitDecoratorMetadata": true,
}
}
```

### Notice for `es2015` compilation

Beginning with Angular 8 the default compile target will be `es2015` (in `tsconfig.json`).
Make sure to add this line in your `src/polyfills.ts` as we need it to read metadata from the models:

```typescript
import 'core-js/proposals/reflect-metadata';
```

**Warning**: If you have circular dependencies in your model definitions (see https://github.com/ghidoz/angular2-jsonapi/issues/236#issuecomment-519473153 for example), you need to change the compile target to `es5` as this lead to runtime errors `ReferenceError: Cannot access 'x' before initialization` (see https://github.com/angular/angular/issues/30106#issuecomment-497699838).

## Usage

### Configuration
Expand Down