Waheed Mohammad Waheed Mohammad - 13 days ago 5
AngularJS Question

why angular not bind Image value into serverside

Here i'm using anguar with bootstrap i'm able to binding textvales not why my image not binding

Html

<div ng-controller="MyCntrl">
<input type="text" placeholder="Emil" ng-model="Email" />
<input type="file" name="file" accept="image/*" ng-model="Image" ngf-select>
<img ngf-thumbnail="Image" />
<input type="button" class="btn btn-sm btn-primary" value="Login" ng-click="Uplode(Image)" />
</div>


Angular.Js

$scope.Uplode = function (file) {
if ($scope.Image != null) {
// if ((Image.type == 'image/png' || Image.type == 'image/jpeg' || Image.type == 'image/gif') && Image.size <= (512 * 1024)) {

if (file.type == 'image/png' || file.type == 'image/jpg' || file.type == 'image/gif' || file.type == "image/jpeg")
{
if (file.size <= (512 * 1024))
{
if (file == file)
{
for (var i = 0; i < file.length; i++) {
dataAsFormData.append(file[i].name, file[i]);
}
}
var xx = {
Image: $scope.file,
Email: $scope.Email,
password: $scope.password,}
var service = MyserviceContect.DataSave(xx);

Answer
var i=file.name;
var x={
Image:i;
}