使用AngularJS上载表单上载要解析的图像
简单的问题,如何创建angularjs上传表单到Parse.com?使用AngularJS上载表单上载要解析的图像,angularjs,parse-platform,upload,Angularjs,Parse Platform,Upload,简单的问题,如何创建angularjs上传表单到Parse.com? 我试图创建一个个人资料图片上传表单使用这个,但它不工作 HTML代码 <div class="col-lg-9" ng-controller="manageProfile"> <form style="margin-top:80px"> <div class="form-group"> <label>Browse for Pict
我试图创建一个个人资料图片上传表单使用这个,但它不工作 HTML代码
<div class="col-lg-9" ng-controller="manageProfile">
<form style="margin-top:80px">
<div class="form-group">
<label>Browse for Picture</label>
<input type="file" name="profPic" id="profPic"></input>
</div>
<button class="btn btn-md" ng-click="uploadPicture()">Upload Picture</button>
</form>
</div>
我在尝试上载时遇到此错误
error: fileuploadcontrol is undefined
在AngularJS中,输入元素使用
ng model
指令将输入绑定到范围变量
<div class="col-lg-9" ng-controller="manageProfile">
<form style="margin-top:80px">
<div class="form-group">
<label>Browse for Picture</label>
<!-- add ng-model directive -->
<input ng-model="fileName" type="file" name="profPic" id="profPic"></input>
</div>
<button class="btn btn-md" ng-click="uploadPicture()">Upload Picture</button>
</form>
</div>
有关
ng型号的更多信息,请参阅。显示您尝试过的代码。同时,请查看我很抱歉没有立即编写代码…已按照答案更改代码,但仍然得到错误:此。\源代码未定义
<div class="col-lg-9" ng-controller="manageProfile">
<form style="margin-top:80px">
<div class="form-group">
<label>Browse for Picture</label>
<!-- add ng-model directive -->
<input ng-model="fileName" type="file" name="profPic" id="profPic"></input>
</div>
<button class="btn btn-md" ng-click="uploadPicture()">Upload Picture</button>
</form>
</div>
profile.controller('manageProfile', ['$scope', function($scope) {
$scope.uploadPicture = function() {
/* replace this
var fileUploadControl = $("#profPic")[0];
var file = fileUploadControl.file[0];
var name = file.name;
*/
//Use ng-model variable
var name = $scope.fileName;
//
};
}]);