繁体   English   中英

如何找到 angular.js 中发生更改的页面?

[英]How can I find the page where ill do the changes in angular.js?

这是一个完成的项目,我被要求解决一个问题。

3 个选择框,并且都有不同的名称。 第一个选择框的名称nameSelectBox162572640796915第二个nameSelectBox16257264317217第三个nameSelectBox162572643286379

选择框3 个值选项,它们是"1"、"2""3" ,如果我选择 1 或 2 或 3,则其他人无法选择我选择的任何内容,

开发人员工具上,我能够做到。

例如:无论我在第一个SelectBox 中选择什么,我都会为第二个编写此代码,以便该选择框无法选择该值

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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM