2
我想设置一些默认值为单选按钮,因为应该选择特定单选按钮的值。为此,我在(controlDirectives.js)文件中创建了一个指令radioControlDir。如何在单选按钮上调用指令来设置Angular Js中的值
function controlDir()
{
return {
transclude: true,
restrict: 'E',
scope: {
ngModel: '=',
queObj: '='
},
link: function (scope, element, attrs)
{
if(angular.isUndefined(scope.ngModel))
{
scope.ngModel = 'Y';
}
}
};
}
scope.queObj._pageAttributes.defaultValue有如果ngmodel没有价值将被设定值。其他文本和选择指令工作正常。