Comments (5)
oh, that's a good one there using ng-if. What do you think about my solution? Is ng-if more efficient?
from angular-image-cropper.
As a workaround I changed the link function to this:
`
'link': function (scope, element, attributes, controller) {
attributes.$observe('imageUrl', function (newValue) {
if (newValue) {
controller.element = element[0];
controller.init();
}
});
}
`
I'am really new to AngularJS and directives but it works for now. Maybe there is a more clean solution.
from angular-image-cropper.
Hi @acromm,
The directive has to have the image url to initialize the cropper UI and set all the dimensions, calculate ratio... etc.
You can just put an ngif on the directive waiting that your image-url
is not undefined. When it will be defined, it will initiate the directive and should not throw error.
Edit:
It seems that we respond at the same time! ✨
from angular-image-cropper.
Hum, your solution works but is kinda really complex for a simple behaviour. Prefer Ngif, you will see immediately what you code do just by looking at it. You'll have more control.
from angular-image-cropper.
Ok Benjamin, thanks a lot for your help.
from angular-image-cropper.
Related Issues (20)
- How to change cropping image width and height dynamically?? HOT 2
- limit decimal places for imgCroper
- Pinch to zoom functionality HOT 2
- Angular 2 Upgrade HOT 6
- crop-callback HOT 2
- Bower not available HOT 1
- How to set Image Cropper controls outside the cropper HOT 5
- Image can be dragged left/right (not fully visible) even after "fit" button is clicked
- I cannot find angular-image-cropper.js file instead i found imageCropper.js HOT 5
- zoom ignore setup and one step is like 10 HOT 3
- Remove rotate control buttons
- Export data as png instead of jpg HOT 1
- rotateImage() cuts of part of image if image isn't square
- Problems with angular 1.6.x: this.actionLabels is not a function HOT 8
- Use with Ng File Upload
- automatically rotate picture captured by iPhone
- angular-image-cropper.js.map Missing
- Image quality is decreasing after crop
- Can't be used without require.js HOT 4
- Current status of maintainer. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-image-cropper.