javascript - Pass $index to the submit form in jade -
i'm doing upload image application. during uploading, show loading gif. have few image in page , user press picture upload image. now, i'm using ng-repeat show image out when page loaded.
below html in jade:
.panel-body form.form-horizontal .form-group(ng-repeat="runningtext in runningtexts") .col-md-3 label.control-label image {{$index+1}} .image-upload-area.label-centerleft p(onclick="$('#imagefile').click()" ng-click="setnum($index)") click me change img.loading(ng-show="isuploading[$index]" src="/img/loading.gif") img.img-responsive.clickable(ng-src="{{runningtext.image != '' ? '/img/' + runningtext.image : '/img/logo_d.png'}}") form#imageupload(enctype="multipart/form-data" action="/api/admin/display/image" ng-upload="uploaddone(content)" method="post") input#imagefile(type="file" name="image" onchange="$('#imagesubmit').click();return false;" style="display:none") input#imagesubmit(type="submit" ng-click="isuploading[$index] = true" style="display:none")
i have created array of isuploading act flag indicate showing uploading gif.
below js:
$scope.uploaddone = function(data) { $scope.runningtexts[imgnum].image = data.path; $scope.isuploading[imgnum] = false; }; $scope.setnum = function(index){ imgnum = index; }
img.loading pass $index value ng-click of form input isuploading set true. when uploading done, flag set false in js , uploading gif hide.
now seems using above jade coding, $index fail pass "ng-click='isuploading[$index] = true'" "img.loading", causing no uploading gif shown.
anyone know what's wrong wif coding?
Comments
Post a Comment