mr-image icon indicating copy to clipboard operation
mr-image copied to clipboard

Can we give image source dynamically?

Open ashish-agarwal24 opened this issue 8 years ago • 4 comments

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?

ashish-agarwal24 avatar Jan 05 '17 09:01 ashish-agarwal24

$scope.file is file or src of file?

taint2310 avatar Jan 12 '17 08:01 taint2310

src of file. My angular app is fetching file using ng-file-upload and i am giving that variable to $scope.image src .

ashish-agarwal24 avatar Jan 16 '17 09:01 ashish-agarwal24

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);

schmidtbt avatar Feb 02 '17 21:02 schmidtbt

I need to browse file and crop that image ..!!! Can you help me how to achieve this

ynotsarath avatar Dec 14 '17 12:12 ynotsarath