angular应用,一个input上有自定义directive和ng-model,怎么在directive更新input的value时更新model
wise.directive('upload', function () {
return {
link: function ($scope, iElement, iAttrs, controller) {
iElement.upload({
success: function(data, self) {
$scope[iAttrs['ngModel']]=data;
$scope.$apply();
},
});
}
};
});
如上的代码在
<input type="text" class="form-control" upload ng-model="pic_pad">
中可用,但是变为这样
<input type="text" class="form-control" upload ng-model="scenetopic.pic_pad">
怎么做?
求优雅的解决方法。
御門小路樣
11 years, 10 months ago