最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Angularjs 根據(jù)一個(gè)select的值去設(shè)置另一個(gè)select的值方法

 更新時(shí)間:2018年08月13日 15:11:09   作者:Franciswmf  
今天小編就為大家分享一篇Angularjs 根據(jù)一個(gè)select的值去設(shè)置另一個(gè)select的值方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧

html:

<div ng-controller="mySelectController">
<select ng-model="myField" ng-options="Field.label for Field in names" 
ng-change="mySelectControllerChange()">
<option value=''>{{'SELECT.LABEL.VXI.CUSTOM.SELECT' | translate}}</option>
</select>
</div>
 <div ng-controller="myRelationController">
<select ng-model="myRelation" ng-options="relation.name for relation in relationList" >
<option value=''>{{'SELECT.LABEL.VXI.CUSTOM.SELECT' | translate}}</option>
</select>
</div>

js:

var mySelectController=['$scope', '$http', '$rootScope', function($scope, $http, $rootScope) {
 
 //$http的method可以是get/delete/head/jsonp/post/put
 //$http服務(wù)快捷的get請(qǐng)求
 //alert('root=='+ACTIVITI.CONFIG.contextRoot);//對(duì)應(yīng)/activiti-explorer/service
 $http({
 method:'PUT',
 url:ACTIVITI.CONFIG.contextRoot +'/getFormFieldList'
 })
 .success(
 function(data,status,headers,config){
 //成功加載
   $scope.names=data;
 })
 .error(
 
 function(data,status,headers,config){
 //處理錯(cuò)誤
 //do nothing
 }
 );
 //change
 $scope.mySelectControllerChange=function(){
 var app=angular.module('activitiModeler',[]);
 if($scope.myField.optionGroupId!=null && $scope.myField.optionGroupId!=''){
 //有optionGroup
 console.log('if');
 $rootScope.relationList = [{id:0,name:'等于'},{id:1,name:'不等于'},{id:2,name:'包含'}];
 }else{
 //沒(méi)有optionGroup
 console.log('else');
 $rootScope.relationList = [{id:0,name:'等于'},{id:3,name:'大于'},{id:4,name:'小于'},{id:5,name:'小于等于'},{id:6,name:'大于等于'},{id:2,name:'包含'}];
 }
 
 }
 
}
];

//AngularJS $emit $broadcast $on

//change
 $scope.mySelectControllerChange=function(){
 var data=null;
 if(null==$scope.myColumnSelectModel){
 data={
  pa:'',
  pb:''
 };
 }else{
 data={
  pa:$scope.myColumnSelectModel,
  pb:$scope.myColumnSelectModel.optionGroupId
 };
 }
 $scope.$emit('to_myParentController_on_myColumnSelectModel_change',data);
 }
 
/*myParentController*/
angular.module('activitiModeler').controller('myParentController',['$rootScope', '$scope', '$http', '$timeout','$window', function ($rootScope, $scope, $http, $timeout,$window) {
 //選擇字段下拉列表,觸發(fā)關(guān)系符下拉
 $scope.$on('to_myParentController_on_myColumnSelectModel_change',function(event,data){
 $scope.$broadcast('to_myRelationController_on_myColumnSelectModel_change',data);
 });
 
 
}]);
 
/*關(guān)系符*/
angular.module('activitiModeler').controller('myRelationController',['$rootScope', '$scope', '$http', '$timeout','$window', function ($rootScope, $scope, $http, $timeout,$window) {
 $scope.myRelationDisableVar=true;
 $scope.objDisableTrue=true;//加上灰背景
 //接收事件-根據(jù)字段顯示下拉
 $scope.$on('to_myRelationController_on_myColumnSelectModel_change',function(event,data){
 if(data.pa!=''){
 $scope.myRelationDisableVar=false;
 $scope.objDisableTrue=false;//去掉灰背景
 if(data.pb!=null && data.pb!=''){
 //有optionGroup
 $scope.relationList = [{id:0,name:'等于'},{id:1,name:'不等于'},{id:2,name:'包含'}];
 }else{
 //沒(méi)有optionGroup
 $scope.relationList = [{id:0,name:'等于'},{id:3,name:'大于'},{id:4,name:'小于'},{id:5,name:'小于等于'},{id:6,name:'大于等于'},{id:2,name:'包含'}];
 }
 }else{
 $scope.relationList=null;
 $scope.myRelationDisableVar=true;
 $scope.objDisableTrue=true;//加上灰背景
 }
 
 });
 
}]);

以上這篇Angularjs 根據(jù)一個(gè)select的值去設(shè)置另一個(gè)select的值方法就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Angular.js去除頁(yè)面中顯示的空行方法示例

    Angular.js去除頁(yè)面中顯示的空行方法示例

    這篇文章主要介紹了Angular.js去除頁(yè)面中顯示的空行方法,文中給出了詳細(xì)的示例代碼供大家參考學(xué)習(xí),相信對(duì)大家具有一定的參考價(jià)值,需要的朋友們下面來(lái)一起看看吧。
    2017-03-03
  • AngularJS中關(guān)于ng-class指令的幾種實(shí)現(xiàn)方式詳解

    AngularJS中關(guān)于ng-class指令的幾種實(shí)現(xiàn)方式詳解

    這篇文章給大家介紹了angularJS中ng-class指令的三種實(shí)現(xiàn)方式,其中包括通過(guò)數(shù)據(jù)的雙向綁定、通過(guò)對(duì)象數(shù)組和通過(guò)key/value這三種方式,有需要的朋友們可以參考學(xué)習(xí),下面來(lái)一起看看吧。
    2016-09-09
  • AngularJS的表單使用詳解

    AngularJS的表單使用詳解

    這篇文章主要介紹了AngularJS的表單使用詳解,在JS原有的基礎(chǔ)上提供了更多與HTML交互的功能,需要的朋友可以參考下
    2015-06-06
  • AngularJS 中括號(hào)的作用詳解

    AngularJS 中括號(hào)的作用詳解

    這篇文章主要介紹了AngularJS 中括號(hào)的作用,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-04-04
  • Angular 2.x學(xué)習(xí)教程之結(jié)構(gòu)指令詳解

    Angular 2.x學(xué)習(xí)教程之結(jié)構(gòu)指令詳解

    結(jié)構(gòu)指令通過(guò)添加和刪除 DOM 元素來(lái)更改 DOM 布局。Angular 中兩個(gè)常見(jiàn)的結(jié)構(gòu)指令是 *ngIf 和 *ngFor,下面這篇文章主要給大家介紹了關(guān)于Angular 2.x結(jié)構(gòu)指令的相關(guān)資料,需要的朋友可以參考下。
    2017-05-05
  • 如何用angularjs制作一個(gè)完整的表格

    如何用angularjs制作一個(gè)完整的表格

    本文給大家分享的是使用angularjs制作一個(gè)完整的表格的真實(shí)案例,結(jié)合前幾篇的內(nèi)容,把整個(gè)完整的代碼分享給大家,有需要的小伙伴可以參考下
    2016-01-01
  • AngularJS的一些基本樣式初窺

    AngularJS的一些基本樣式初窺

    這篇文章主要介紹了AngularJS的一些基本樣式初窺,AngularJS是一款高人氣JavaScript框架,需要的朋友可以參考下
    2015-07-07
  • Angularjs之ngModel中的值驗(yàn)證綁定方法

    Angularjs之ngModel中的值驗(yàn)證綁定方法

    今天小編就為大家分享一篇Angularjs之ngModel中的值驗(yàn)證綁定方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2018-09-09
  • AngularJS入門(mén)教程之更多模板詳解

    AngularJS入門(mén)教程之更多模板詳解

    本文主要介紹AngularJS模板的資料知識(shí),這里幫大家整理了詳細(xì)的模版資料,及實(shí)現(xiàn)示例代碼,幫助大家學(xué)習(xí)AngularJS的知識(shí),有需要的小伙伴可以參考下
    2016-08-08
  • 詳解AngularJs中$resource和restfu服務(wù)端數(shù)據(jù)交互

    詳解AngularJs中$resource和restfu服務(wù)端數(shù)據(jù)交互

    之前小編和大家分享過(guò)使用$http同服務(wù)器進(jìn)行通信,但是功能上比較簡(jiǎn)單,angularjs還提供了另外一個(gè)可選的服務(wù)$resource,使用它可以非常方便的同支持restful的服務(wù)單進(jìn)行數(shù)據(jù)交互。下面來(lái)一起看看吧。
    2016-09-09

最新評(píng)論

岑巩县| 闸北区| 呼和浩特市| 洛阳市| 营山县| 丹寨县| 秭归县| 临武县| 东乡县| 江西省| 平潭县| 怀远县| 大宁县| 炉霍县| 中牟县| 浦东新区| 泰兴市| 宁海县| 满洲里市| 大同县| 油尖旺区| 镇安县| 清新县| 绍兴县| 宁河县| 泾源县| 合江县| 东山县| 林周县| 许昌市| 铜川市| 冷水江市| 天祝| 三亚市| 海安县| 黄龙县| 黄骅市| 西林县| 彝良县| 通辽市| 鱼台县|