如何禁用不同的选择方案,以便有总是选择不同的选项? [英] How can I disable options for different selects in order to have always different options selected?

查看:170
本文介绍了如何禁用不同的选择方案,以便有总是选择不同的选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与Angularjs工作。

I'm working with Angularjs.

HTML

<select name="questionId1" ng-model="abCtrl.form.questionSel.q1" ng-options="question.val for question in abCtrl.form.questions track by question.index"></select>

<select name="questionId2" ng-model="abCtrl.form.questionSel.q2" ng-options="question.val for question in abCtrl.form.questions track by question.index"></select>

我想用户选择将为其他选择,反之亦然。

I'd like the option the user selects will be disabled for the other selection and vice versa

推荐答案

更​​换 NG-选项 NG-重复 -ed选项可以类比为一个回归...

Replacing ng-options with ng-repeat-ed options can be assimilated to a regression...

您可以使用 ...禁用时... 语法 NG-选项

首页 NG-选项

First ng-options:

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

NG-选项

Second ng-options:

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

下面是一个 小提琴

Here is a fiddle

这篇关于如何禁用不同的选择方案,以便有总是选择不同的选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆