angularjs - How can I change value of angular object used in HTML? -
i need change value in html using angular click. value getting changed in angular function not reflecting in html. angularjs , html :-
$scope.gettbldata = function (name) { var data = $.param({ tblname: name }); var mytbldatalist = []; $scope.tempname = ''; $scope.tempname = name; if (name == 'contacttbl') { $('#contacttbl').show(); $('#coursetbl').hide(); $('#coursedesctbl').hide(); $('#coursesubdesctbl').hide(); $('#interntbl').hide(); $('#locationtbl').hide(); } else if (name == 'coursetbl') { $('#contacttbl').hide(); $('#coursetbl').show(); $('#coursedesctbl').hide(); $('#coursesubdesctbl').hide(); $('#interntbl').hide(); $('#locationtbl').hide(); } else if (name == 'coursedesctbl') { $('#contacttbl').hide(); $('#coursetbl').hide(); $('#coursedesctbl').show(); $('#coursesubdesctbl').hide(); $('#interntbl').hide(); $('#locationtbl').hide(); } else if (name == 'coursesubdesc') { $('#contacttbl').hide(); $('#coursetbl').hide(); $('#coursedesctbl').hide(); $('#coursesubdesctbl').show(); $('#interntbl').hide(); $('#locationtbl').hide(); } else if (name == 'interntbl') { $('#contacttbl').hide(); $('#coursetbl').hide(); $('#coursedesctbl').hide(); $('#coursesubdesctbl').hide(); $('#interntbl').show(); $('#locationtbl').hide(); } else if (name == 'locationtbl') { $('#contacttbl').hide(); $('#coursetbl').hide(); $('#coursedesctbl').hide(); $('#coursesubdesctbl').hide(); $('#interntbl').hide(); $('#locationtbl').show(); } $http({ url: '/admin/fetchtbldata', method: 'post', data: data, headers: { 'content-type': 'application/x-www-form-urlencoded; charset=utf-8' } }).success(function (data) { $scope.mytbldatalist = data; }).error(function (data) { alert('cannot load table data') }); }//gettbldata end
<li ng-repeat="r in mytbllist"> <a href="#" data-ng-click="gettbldata(r.tblname)"> <i class="glyphicon glyphicon-ok"></i> {{r.tblname}} </a> </li> <h2>{{tempname}} details</h2> <div class="table-responsive"> <table id="coursetbl" class="table table-hover table-bordered" style="margin:0px 5px; width:1070px"> <thead style="background-color:aqua"> <tr> <td> s. no. </td> <td> id </td> <td> name </td> <td> description </td> <td> image </td> <td> courselink </td> <td> action </td> </tr> </thead> <tbody> <tr ng-repeat="r in mytbldatalist"> <td> {{$index+1}} </td> <td> {{r.id}} </td> <td> {{r.name}} </td> <td> {{r.description}} </td> <td> <img src="~/img/course-img/{{r.img}}" height="200px" width="200px" /> @*{{r.img}}*@ </td> <td> {{r.courselink}} </td> <td> <div class="btn btn-group-xs"> <input type="button" class="btn btn-lg btn-info" ng-click="edititem(r.id)" value="edit" /> <input type="button" class="btn btn-xs btn-danger" value="delete" /> </div> </td> </tr> </tbody> </table> </div>
but problem on click of anchor tag value of $scope.tempname changes in angularjs function value of {{tempname}} doesn't change.
Comments
Post a Comment