如何找到我将在 angular.js 中进行更改的页面?
How can I find the page where ill do the changes in angular.js?
这是一个已完成的项目,我被要求解决一个问题。
有 3 select 个盒子,并且都有不同的名称。第一个select盒子的名字是nameSelectBox162572640796915
,第二个是nameSelectBox16257264317217
,第三个一个 nameSelectBox162572643286379
select 个框 有 3 个值 选项,它们是 "1", " 2" 或 "3",如果我选择 1 或 2 或 3,无论我选择什么都不会 select 对其他人可用,
在开发者工具上,我可以做到。
例如:无论我在第一个 SelectBox 中选择什么,我都为第二个编写此代码,
所以那个 select 框
的值不会 select
var source = document.getElementsByName("nameSelectBox162572640796915")[0];
source.value
document.getElementsByName("nameSelectBox16257264317217")[0].options[source.value].setAttribute("disabled","disabled")
我看的页面是http://localhost:3000/#/form
但是我找不到那个页面,而且我不知道在哪里编写对我有用的代码...
我该怎么做?
这是一种方法。设置要通过 ng-repeat 创建的选项,然后使用 ng-disabled 测试已经选择了哪些数字
angular.module('myApp', [
// myApp dependencies (controllers, etc.) injected here...
'myApp.controllers'
]);
angular.module('myApp.controllers', []).
controller('MyCtrl', ['$scope', function($scope) {
$scope.select1 = '';
$scope.select2 = '';
$scope.select3 = '';
$scope.numbers = [1, 2, 3, 4, 5];
}])
<html ng-app="myApp" ng-controller="MyCtrl">
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<select ng-model="select1">
<option ng-repeat='num in numbers' ng-disabled="(select2 == num || select3 == num)">{{num}}</option>
</select>
<select ng-model="select2">
<option ng-repeat='num in numbers' ng-disabled="(select1 == num || select3 == num)">{{num}}</option>
</select>
<select ng-model="select3">
<option ng-repeat='num in numbers' ng-disabled="(select2 == num || select1 == num)">{{num}}</option>
</select>
</html>
这是一个已完成的项目,我被要求解决一个问题。
有 3 select 个盒子,并且都有不同的名称。第一个select盒子的名字是nameSelectBox162572640796915
,第二个是nameSelectBox16257264317217
,第三个一个 nameSelectBox162572643286379
select 个框 有 3 个值 选项,它们是 "1", " 2" 或 "3",如果我选择 1 或 2 或 3,无论我选择什么都不会 select 对其他人可用,
在开发者工具上,我可以做到。
例如:无论我在第一个 SelectBox 中选择什么,我都为第二个编写此代码, 所以那个 select 框
的值不会 selectvar source = document.getElementsByName("nameSelectBox162572640796915")[0];
source.value
document.getElementsByName("nameSelectBox16257264317217")[0].options[source.value].setAttribute("disabled","disabled")
我看的页面是http://localhost:3000/#/form
但是我找不到那个页面,而且我不知道在哪里编写对我有用的代码... 我该怎么做?
这是一种方法。设置要通过 ng-repeat 创建的选项,然后使用 ng-disabled 测试已经选择了哪些数字
angular.module('myApp', [
// myApp dependencies (controllers, etc.) injected here...
'myApp.controllers'
]);
angular.module('myApp.controllers', []).
controller('MyCtrl', ['$scope', function($scope) {
$scope.select1 = '';
$scope.select2 = '';
$scope.select3 = '';
$scope.numbers = [1, 2, 3, 4, 5];
}])
<html ng-app="myApp" ng-controller="MyCtrl">
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<select ng-model="select1">
<option ng-repeat='num in numbers' ng-disabled="(select2 == num || select3 == num)">{{num}}</option>
</select>
<select ng-model="select2">
<option ng-repeat='num in numbers' ng-disabled="(select1 == num || select3 == num)">{{num}}</option>
</select>
<select ng-model="select3">
<option ng-repeat='num in numbers' ng-disabled="(select2 == num || select1 == num)">{{num}}</option>
</select>
</html>