📅  最后修改于: 2022-03-11 15:02:21.610000             🧑  作者: Mango
app.directive('labelField', function () {
return {
restrict: 'AE',
link: function ($scope, element, attrs) {
$scope.$watch(attrs['ngModel'], function (newValue) {
if (newValue) {
element[0].value = newValue[attrs['labelField']];
}
})
}
}
})