trim trim -4 years ago 119
AngularJS Question

Angular ng-repeat not working with $

I've tried a long time to solve my problem. The problem is after fetching data by post method my HTML content is not updating. My pages are being changed by

and the codes is as follows:

socialGroup.config(function($routeProvider) {
$routeProvider.when('/my-groups', {
templateUrl: 'my-groups.html'
}).otherwise({ templateUrl: 'dashboard.html' });


<script type="text/ng-template" id="my-groups.html">
<div data-ng-controller="myGroups" class="form">
<div class="row">
<div class="col-md-12 col-sm-12"><h1>My Groups</h1></div>
<div class="col-md-12 col-sm-12">
<table class="table table-hover table-inverse">
<tr class="success">
<th><i class="fa fa-users" aria-hidden="true"></i>Group Name</th>
<th><i class="fa fa-wrench" aria-hidden="true"></i>Action</th>
<th><i class="fa fa-sun-o" aria-hidden="true"></i>Status</th>

<div class="row" data-ng-repeat="group in groups">
<tr class="info">
<th scope="row">{{}}</th>
<a href="#/stays-group/{{group.token}}" class="text-info" title="View {{}} posts.">
<a href="{{}}" title="{{group.label}}">
<td title="Group is active">
<label data-ng-show="" class="text-success" ><b>Active</b></label>
<label data-ng-hide="" class="text-danger" ><b>Inactive</b></label>


socialGroup.controller('myGroups', function($scope, $http) {
$scope.groups = [];
method: "post",
url: 'my-groups-link',
data: $.param({ token:sha1( Math.random() ) }),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).then(function success(response) {
$scope.groups =;
}, function error(response) {});

I observed my console and showed the data had come from the server but the data is not updating to view.

Any suggestion will be appreciated.

Answer Source

Not sure if this is the problem but you can't have a <div> in <tr>

Just loop over your data by using ng-repeat on <tr>

    <tr class="info" data-ng-repeat="group in groups">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download