Binding the Drop Box Angularjs code:
//Active Pull -down toggle$scope. Activitychange =function () {varCards =NewArray (); varURL ="/customcard/getcustomcardlistbyact"; $.ajax ({url:url, type:'Get', Async:false, data: {actname: $scope. Formdata.selectactivitytype}, Success:functi On (data) {if(Data! =NULL) {$.each (data, function (I, n) {//, cu. Isbinddealerid,cu. Isbindvin, cu. Writeoffnumber varCardinfo ={activity:n.activitytype, Cardid:n.cardtype, Cardtitle:n.cardtypename, Code:n.code, Isbinddealerid:n.isbinddea Lerid, Isbindvin:n.isbindvin, Writeoffnumber:n.writeoffnumber} Cards.push (Cardinfo); }); $scope. Cardtypes=cards; }}, Error:function (err) {alert ("error ..."); } }); }
Common binding drop Box HTML code notation:
<Divclass= "Form-group"> <labelclass= "Col-md-2 Control-label">Kari Type:</label> <SelectNg-change= "Activitychangetype ()"ID= "II"class= "Col-md-2 Form-control"Ng-model= "Formdata.selectcardtype"ng-options= "M.cardid as M.cardtitle for M in Cardtypes" > <optionvalue="">Please select</option> </Select> </Div>
Normal value drop-down box value notation:
// Card Coupon Type drop-down toggle $scope. Activitychangetype = function () { console.log (" card type selected "); // value from the drop-down box Console.log ($scope. formdata.selectcardtype); }
To bind multiple attributes to the drop-down box HTML code notation:
<Divclass= "Form-group"> <labelclass= "Col-md-2 Control-label">Kari Type:</label> <SelectNg-change= "Activitychangetype ()"ID= "II"class= "Col-md-2 Form-control"Ng-model= "Formdata.selectcardtype"ng-options= "Y.cardtitle for (x, y) in Cardtypes"> <optionvalue="">Please select</option> </Select> </Div>
Multiple attribute values:
//Card Coupon Type drop-down toggle$scope. Activitychangetype =function () {Console.log ("type of card coupon selected"); Console.log ($scope. FormData.SelectCardType.cardid); Console.log ($scope. formData.SelectCardType.IsBindDealerId); Console.log ($scope. FormData.SelectCardType.IsBindVIN); Console.log ($scope. FormData.SelectCardType.WriteOffNumber); if($scope .formdata.selectcardtype.writeoffnumber>1) {Console.log ("the number of cards you choose can be more than 1"); //$scope. Formdata.movingcode . } }
Angularjs binding multiple properties to a drop-down box