我是 AngularJS 的新手,在上传图像之前尝试设置一些参数时,我被卡在了这个 ng-click 上。这是代码:
<div ng-controller="TestCtrl">
<div data-ng-click="readUploadedImage('grPhoto', '{{ id }}')">
<label class="changePhotoBtn" for="uploadBanner">Click Here</label>
<input style="display: none;" type="file" name="Upload a file" id="uploadBanner" />
</div>
</div>
var myApp = angular.module('myApp',[]);
function TestCtrl($scope) {
$scope.id = 1234;
$scope.readUploadedImage = function(parentClass, spid) {
alert(parentClass + ' ' + spid);
}
}
链接到小提琴:http: //jsfiddle.net/CMJkg/2/