javascript - Dynamically adding ng-model to input boxes attribute using jquery -
i want dynamically add ng-model input boxes attribute using jquery. want because have on 10 input boxes, want use one. have done have many check boxes , when check on specific 1 input boxes slide down.
$(function() { $( "#datepickerfr" ).datepicker(); $( "#datepickerto" ).datepicker(); $('#dateinput').slideup(); $('#textinput').slideup(); var optionc = []; $('[name="searchoption"]').each(function(i, obj) { $(this).click(function() { var textsearch = $(this).parent().text(); var e_name = $(this).attr('id'); var lastname = e_name.substring(e_name.length - 4, e_name.length); if (lastname == "date") { $('#searchlabeld').html(textsearch + " pick date ( month | day | year )"); $('#datepickerfr').attr('ng-model', e_name + 'fr'); $('#datepickerto').attr('ng-model', e_name + 'to'); $('#dateinput').slidedown(); $('#textinput').slideup(); } else { $('#inputsearch').attr('ng-model', "search." + e_name); $('#searchlabelt').html(textsearch); $('#dateinput').slideup(); $('#textinput').slidedown(); } }); }); });
so far when @ inspector element see ng-model attribute there doesnt seem doing anything.
why not assign ng-model empty $scope variables, , fill 1 want fill instead of trying add ng-model. reason why isn't working angularharsh said, because angular code allready applied when adding ng-model jquery
Comments
Post a Comment