javascript - Angular js when i use http.get in a controller function then it is not rendering response data -


i want render response of http.get() function of angularjs, problem when use http.get in controller function not rendering response data.

view:

<div ng-app="myapp" ng-controller="dtlctrl"  >     <div class="table-responsive">         <table  class="table  table-striped">             <thead>                 <th> name</th>                 <th >storage</th>                 <th >credits</th>             </thead>             <tbody>                 <tr ng-repeat="a in credits" >                     <td><a  href="#">{{ a.username }}</a></td>                     <td>{{ a.storage }}</td>                     <td>{{ a.credits }}</td>                 </tr>             </tbody>             </table>         <div class="clearfix"></div>     </div> </div> </div>     <div class="modal-footer ">         <button type="button" class="btn btn-warning btn-lg" style="width: 100%;"><span class="glyphicon glyphicon-ok-sign"></span> update</button>     </div> </div> <!-- /.modal-content -->  </div> <!-- /.modal-dialog -->  </div> 

javascript:

app.controller('dtlctrl', function($scope, $http) {     //var count;     //window.names=" ";        //count=0;     $scope.crd=function(name) {           // alert("http://localhost:8080/zencameraadmin/admin/getusercredits?username="+name);         // count=1;         $scope.credits;         window.names=name;         //alert(window.names);         $http.get("http://192.168.0.87:8080/zencameraadminservices/admin/getusercredits?username="+window.names)         .success(function (response) {$scope.credits = response.credits;             //console.log(response.plans);         });         //alert(window.names);         console.log($scope.credits);         return $scope.credits;     }; }); 


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -