📜  输入类型显示对象 angularjs - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:21.610000             🧑  作者: Mango

代码示例1
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']];
                }
            })
        }
    }
})