Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何禁用不同选择的选项,以便始终选择不同的选项?_Angularjs_Ng Options_Angularjs Select - Fatal编程技术网

Angularjs 如何禁用不同选择的选项,以便始终选择不同的选项?

Angularjs 如何禁用不同选择的选项,以便始终选择不同的选项?,angularjs,ng-options,angularjs-select,Angularjs,Ng Options,Angularjs Select,我和Angularjs一起工作 HTML: 我希望用户选择的选项将在其他选择中被禁用,反之亦然,有两种方式: 请看栈柱:。解释了一个好的解决方案 按实例使用multi-slect组件: 两种方式: 请看栈柱:。解释了一个好的解决方案 按实例使用multi-slect组件: 两种方式: 请看栈柱:。解释了一个好的解决方案 按实例使用multi-slect组件: 两种方式: 请看栈柱:。解释了一个好的解决方案 按实例使用multi-slect组件: 你能试试angularngDisabl

我和Angularjs一起工作

HTML:


我希望用户选择的选项将在其他选择中被禁用,反之亦然,有两种方式:

  • 请看栈柱:。解释了一个好的解决方案

  • 按实例使用multi-slect组件:

两种方式:

  • 请看栈柱:。解释了一个好的解决方案

  • 按实例使用multi-slect组件:

两种方式:

  • 请看栈柱:。解释了一个好的解决方案

  • 按实例使用multi-slect组件:

两种方式:

  • 请看栈柱:。解释了一个好的解决方案

  • 按实例使用multi-slect组件:


你能试试angular
ngDisabled
网络上有很多例子,你能上网冲浪吗。在这里我还附加了一些示例代码,如

对于
ngDisabled

<!DOCTYPE html>
<html ng-app="sample">
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<body>
<script>
   angular.module('sample',[]).controller('sampleCntrl',function($rootScope){
   $rootScope.disableVal= true;
   });
</script>
<div ng-controller="sampleCntrl">
<p>
<button ng-disabled="disableVal">Click Me!</button>
</p>
<p>
<input type="checkbox" ng-model="mySwitch"/>Button
</p>
<p>
<button ng-disabled="disableVal">Click Me!</button>
</p>
<p>
<input type="checkbox" ng-model="mySwitch"/>Button
</p>
<p>
{{ mySwitch }}
</p>
</div> 
</body>
</html>

angular.module('sample',[]).controller('sampleCntrl',function($rootScope){
$rootScope.disableVal=true;
});

点击我!

按钮

点击我!

按钮

{{mySwitch}}


你可以试试angular
ngDisabled
网络上有很多例子,你可以浏览一下吗。在这里我还附加了一些示例代码,如

对于
ngDisabled

<!DOCTYPE html>
<html ng-app="sample">
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<body>
<script>
   angular.module('sample',[]).controller('sampleCntrl',function($rootScope){
   $rootScope.disableVal= true;
   });
</script>
<div ng-controller="sampleCntrl">
<p>
<button ng-disabled="disableVal">Click Me!</button>
</p>
<p>
<input type="checkbox" ng-model="mySwitch"/>Button
</p>
<p>
<button ng-disabled="disableVal">Click Me!</button>
</p>
<p>
<input type="checkbox" ng-model="mySwitch"/>Button
</p>
<p>
{{ mySwitch }}
</p>
</div> 
</body>
</html>

angular.module('sample',[]).controller('sampleCntrl',function($rootScope){
$rootScope.disableVal=true;
});

点击我!

按钮

点击我!

按钮

{{mySwitch}}


你可以试试angular
ngDisabled
网络上有很多例子,你可以浏览一下吗。在这里我还附加了一些示例代码,如

对于
ngDisabled

<!DOCTYPE html>
<html ng-app="sample">
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<body>
<script>
   angular.module('sample',[]).controller('sampleCntrl',function($rootScope){
   $rootScope.disableVal= true;
   });
</script>
<div ng-controller="sampleCntrl">
<p>
<button ng-disabled="disableVal">Click Me!</button>
</p>
<p>
<input type="checkbox" ng-model="mySwitch"/>Button
</p>
<p>
<button ng-disabled="disableVal">Click Me!</button>
</p>
<p>
<input type="checkbox" ng-model="mySwitch"/>Button
</p>
<p>
{{ mySwitch }}
</p>
</div> 
</body>
</html>

angular.module('sample',[]).controller('sampleCntrl',function($rootScope){
$rootScope.disableVal=true;
});

点击我!

按钮

点击我!

按钮

{{mySwitch}}


你可以试试angular
ngDisabled
网络上有很多例子,你可以浏览一下吗。在这里我还附加了一些示例代码,如

对于
ngDisabled

<!DOCTYPE html>
<html ng-app="sample">
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<body>
<script>
   angular.module('sample',[]).controller('sampleCntrl',function($rootScope){
   $rootScope.disableVal= true;
   });
</script>
<div ng-controller="sampleCntrl">
<p>
<button ng-disabled="disableVal">Click Me!</button>
</p>
<p>
<input type="checkbox" ng-model="mySwitch"/>Button
</p>
<p>
<button ng-disabled="disableVal">Click Me!</button>
</p>
<p>
<input type="checkbox" ng-model="mySwitch"/>Button
</p>
<p>
{{ mySwitch }}
</p>
</div> 
</body>
</html>

angular.module('sample',[]).controller('sampleCntrl',function($rootScope){
$rootScope.disableVal=true;
});

点击我!

按钮

点击我!

按钮

{{mySwitch}}


尝试使用不同的方法,如下所示

<select name="questionId1" ng-model="abCtrl.form.questionSel.q1">
<option ng-repeat="question in abCtrl.form.questions" value="{{question.val}}" 
ng-disabled="abCtrl.secondSelectValue == question.val"
ng-selected="abCtrl.firstSelectValue == question.val">{{question.val}}
</option>
</select>

{{question.val}}

abCtrl.firstSelectValue将是您的选择框的默认值(否则它第一次将有空选择)

尝试使用不同的方法,如下所示

<select name="questionId1" ng-model="abCtrl.form.questionSel.q1">
<option ng-repeat="question in abCtrl.form.questions" value="{{question.val}}" 
ng-disabled="abCtrl.secondSelectValue == question.val"
ng-selected="abCtrl.firstSelectValue == question.val">{{question.val}}
</option>
</select>

{{question.val}}

abCtrl.firstSelectValue将是您的选择框的默认值(否则它第一次将有空选择)

尝试使用不同的方法,如下所示

<select name="questionId1" ng-model="abCtrl.form.questionSel.q1">
<option ng-repeat="question in abCtrl.form.questions" value="{{question.val}}" 
ng-disabled="abCtrl.secondSelectValue == question.val"
ng-selected="abCtrl.firstSelectValue == question.val">{{question.val}}
</option>
</select>

{{question.val}}

abCtrl.firstSelectValue将是您的选择框的默认值(否则它第一次将有空选择)

尝试使用不同的方法,如下所示

<select name="questionId1" ng-model="abCtrl.form.questionSel.q1">
<option ng-repeat="question in abCtrl.form.questions" value="{{question.val}}" 
ng-disabled="abCtrl.secondSelectValue == question.val"
ng-selected="abCtrl.firstSelectValue == question.val">{{question.val}}
</option>
</select>

{{question.val}}

abCtrl.firstSelectValue将是您选择框的默认值(否则它第一次将有空选择)

ng repeat
替换
ng选项
-可将已删除的选项等同于回归

您可以使用
。。。当…
语法在
ng选项中时禁用:

首先
ng选项

...  disable when (question.index === questionSel.q2)  ...
...  disable when (question.index === questionSel.q1)  ...
ng选项

...  disable when (question.index === questionSel.q2)  ...
...  disable when (question.index === questionSel.q1)  ...

这里有一个

ng repeat
替换
ng选项
-ed选项可以被视为回归

您可以使用
。。。当…
语法在
ng选项中时禁用:

首先
ng选项

...  disable when (question.index === questionSel.q2)  ...
...  disable when (question.index === questionSel.q1)  ...
ng选项

...  disable when (question.index === questionSel.q2)  ...
...  disable when (question.index === questionSel.q1)  ...

这里有一个

ng repeat
替换
ng选项
-ed选项可以被视为回归

您可以使用
。。。当…
语法在
ng选项中时禁用:

首先
ng选项

...  disable when (question.index === questionSel.q2)  ...
...  disable when (question.index === questionSel.q1)  ...
ng选项

...  disable when (question.index === questionSel.q2)  ...
...  disable when (question.index === questionSel.q1)  ...

这里有一个

ng repeat
替换
ng选项
-ed选项可以被视为回归

您可以使用
。。。当…
语法在
ng选项中时禁用:

首先
ng选项

...  disable when (question.index === questionSel.q2)  ...
...  disable when (question.index === questionSel.q1)  ...
ng选项

...  disable when (question.index === questionSel.q2)  ...
...  disable when (question.index === questionSel.q1)  ...

这里是一个

为什么不使用两种不同的模型?为什么不使用两种不同的模型?为什么不使用两种不同的模型?为什么不使用两种不同的模型?我有两种不同的选择,具有相同的选项值和内容,我想在selB中禁用我在selA和vice versaI中选择的选项我有两个不同的选择,具有相同的选项值和内容,我想在selB中禁用我在selA和vice versaI中选择的选项我有两个不同的选择,具有相同的选项值和内容,我想在selB中禁用我在selA和vice versaI中选择的选项我有两个不同的选择,具有相同的选项值和内容,我想在selB中禁用我在selA和vice versaI中选择的选项我必须在selA中禁用在selB中选择的选项。。。ng disabled如何帮助我?我更新了答案,请检查,我的想法是将
ngDisabled
var设置为
$rootScope
。然后,无论何时单击它,它都会自动更新,我们使用的每个位置也集中在
ng模型上。我必须将selA中选择的选项禁用为selB。。。ng残疾人如何帮助我?我更新了an