mr-image
mr-image copied to clipboard
Can we give image source dynamically?
I need to draw a canvas after user uploads the picture. So i have to give image on run time. The following code is not working
$scope.image = { src: $scope.file, maxWidth: 938 };
Can somebody help me out on this?
$scope.file is file or src of file?
src of file. My angular app is fetching file using ng-file-upload and i am giving that variable to $scope.image src .
I had a work-around for this:
Create the HTML content:
var htmlContent = "<div class='panel panel-default' mr-image mr-src='image.src' mr-max width='image.maxWidth' mr-selector='selector' mr-drawer='drawer'></div>";
Then compile and inject it (need $compile in your controller):
var el = $compile( htmlContent )($scope); var element = document.getElementById("mrImageLocation"); angular.element(document.getElementById("mrImageLocation")).append(el);
I need to browse file and crop that image ..!!! Can you help me how to achieve this