Skip to content
Snippets Groups Projects
Commit d5bebc9e authored by Emmanuel ROHEE's avatar Emmanuel ROHEE
Browse files

Added another button to upload and send an image.

The text input and its send button for sending an image URL will be removed once we have a true upload image service
parent 39ff6c84
No related branches found
No related tags found
No related merge requests found
......@@ -402,6 +402,23 @@ angular.module('RoomController', ['ngSanitize'])
});
};
$scope.imageFileToSend;
$scope.$watch("imageFileToSend", function(newValue, oldValue) {
if ($scope.imageFileToSend) {
// First download the image to the Internet
console.log("Uploading image...");
mFileUpload.uploadFile($scope.imageFileToSend).then(
function(url) {
// Then share the URL
$scope.sendImage(url);
},
function(error) {
$scope.feedback = "Can't upload image";
}
);
}
});
$scope.loadMoreHistory = function() {
paginate(MESSAGES_PER_PAGINATION);
};
......
......@@ -75,9 +75,10 @@
<input id="mainInput" ng-model="imageURLToSend" ng-enter="sendImage()" placeholder="Image URL"/>
</td>
<td width="100px">
<button ng-click="sendImage(imageURLToSend)">Send Image</button>
<button ng-click="sendImage(imageURLToSend)">Send URL</button>
</td>
<td>
<td width="100px">
<button m-file-input="imageFileToSend">Send Image</button>
</td>
</tr>
</table>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment