Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Angular 16+ #631

Merged
merged 7 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
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
18 changes: 0 additions & 18 deletions .browserslistrc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v2
Expand Down
39 changes: 10 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,9 @@

### Upgrade instructions
For a list of breaking changes and update instructions, go to [releases](https://github.com/Mawi137/ngx-image-cropper/releases).
Only Angular 13+ is supported since image cropper version `6.0.0`.
Only Angular 16+ is supported.

### Example usage
Add the ImageCropperModule to the imports of the module which will be using the Image Cropper.
``` typescript
import { NgModule } from '@angular/core';
import { ImageCropperModule } from 'ngx-image-cropper';

@NgModule({
imports: [
...
ImageCropperModule
],
declarations: [
...
],
exports: [
...
],
providers: [
...
]
})
export class YourModule {
}
```

Add the element to your HTML:
``` html
Expand All @@ -53,21 +30,25 @@ Add the element to your HTML:
<img [src]="croppedImage" />
```

And add this to your ts file:
In your ts file, declare the usage of `ImageCropperComponent` and add the following methods:
``` typescript
import { ImageCroppedEvent, LoadedImage } from 'ngx-image-cropper';
import { ImageCropperComponent, ImageCroppedEvent, LoadedImage } from 'ngx-image-cropper';
import { DomSanitizer } from '@angular/platform-browser';

@Component({
standalone: true,
imports: [ImageCropperComponent]
})
export class YourComponent {
imageChangedEvent: any = '';
croppedImage: any = '';
imageChangedEvent: Event | null = null;
croppedImage: SafeUrl = '';

constructor(
private sanitizer: DomSanitizer
) {
}

fileChangeEvent(event: any): void {
fileChangeEvent(event: Event): void {
this.imageChangedEvent = event;
}
imageCropped(event: ImageCroppedEvent) {
Expand Down
11 changes: 7 additions & 4 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-builders/jest:run",
"builder": "@angular-devkit/build-angular:jest",
"options": {
"tsConfig": "tsconfig.spec.json"
"tsConfig": "projects/ngx-image-cropper/tsconfig.spec.json",
"polyfills": [
"zone.js",
"zone.js/testing"
]
}
}
}
Expand All @@ -49,7 +53,7 @@
"outputPath": "dist/demo-app",
"index": "projects/demo-app/src/index.html",
"main": "projects/demo-app/src/main.ts",
"polyfills": "projects/demo-app/src/polyfills.ts",
"polyfills": ["zone.js"],
"tsConfig": "projects/demo-app/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
Expand Down Expand Up @@ -109,7 +113,6 @@
}
}
},
"defaultProject": "demo-app",
"cli": {
"analytics": false
}
Expand Down
6 changes: 0 additions & 6 deletions jest.config.js

This file was deleted.

Loading
Loading