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 servicepaul/schema_breaking_changes
parent
39ff6c840f
commit
d5bebc9eaa
|
@ -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() {
|
$scope.loadMoreHistory = function() {
|
||||||
paginate(MESSAGES_PER_PAGINATION);
|
paginate(MESSAGES_PER_PAGINATION);
|
||||||
};
|
};
|
||||||
|
|
|
@ -75,9 +75,10 @@
|
||||||
<input id="mainInput" ng-model="imageURLToSend" ng-enter="sendImage()" placeholder="Image URL"/>
|
<input id="mainInput" ng-model="imageURLToSend" ng-enter="sendImage()" placeholder="Image URL"/>
|
||||||
</td>
|
</td>
|
||||||
<td width="100px">
|
<td width="100px">
|
||||||
<button ng-click="sendImage(imageURLToSend)">Send Image</button>
|
<button ng-click="sendImage(imageURLToSend)">Send URL</button>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td width="100px">
|
||||||
|
<button m-file-input="imageFileToSend">Send Image</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue