angularjs

hi. Ok I am returning json data but i am not able to view it. I tryied everything. but I can view the json object when I put {{members}} but cannot view it when i put {{members.name}}
Also when I do return comes up undefined and i receive at least 20 blank rows. weird
my controller
app.controller('cvGetMem', function ($scope, $http, toastr, memberRepository) {
    angular.forEach(memberRepository, function (value) { $scope.getmemberlist = value });

Open in new window

my repository
app.factory('memberRepository', function ($http, $q) {
return {
              get: function() {
            var deferred = $q.defer();
            $http.get('MemberList/GetMembers').success(deferred.resolve).error(deferred.reject);
            var member = {};
            return deferred.promise;
}
}
});

Open in new window

my View
<div ng-app="app">
<div>
    <div class="well"><h4>Edit Members</h4></div></div>
    <div class="row">
       
     
           <div class="col-md-7"  ng-controller="cvGetMemberListGrid">
       
               {{members}}
                    <div  style="margin-bottom:150px;">
                        <div class="form-group">
                            <label class="col-lg-2 control-label" style="white-space: nowrap; font-size:22px; padding-bottom:50px;">Select Member</label>
                            <div class="col-lg-7">
                                <select class="form-control"  id="select"   ng-model="ame" ng-options="item.memberId as item.name for item in members">
                                    <option value="">---Please select---</option> 
                                </select>
                            </div>
                        </div>
                    </div>
                <hr />
               <div>
                <div>
                 
                        <div class="input-group" style="  padding-left:210px;">
                            <input type="text" class="form-control" placeholder="Search" ng-model="searchText" name="searchText" id="searchText">
                            <div class="input-group-btn">
                                <span class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></span>
                            </div>
                        </div>
                  
                 
                    <table id="table-pagination" data-search="true" class="table table-striped table-hover table-condensed"  data-pagination="true" >
                        <thead>
                            <tr>
                                <th>Member Name</th>
                                <th>&nbsp;</th>
                                <th>&nbsp;</th>
                                <th>&nbsp;</th>
                            </tr>
                        </thead>
                         <tr ng-repeat="member in members  | filter:searchText ">
                           
                            <td>
                                {{member.name}}
                            </td>
                            <td>
                             
                            </td>
                        </tr>
                    </table>

Open in new window


my Json
[{"memberID":2,"name":"utires, inc.","addressLine1":"1street","addressLine2":null,"}]
{{member}} returns this json.

Open in new window

LVL 9
Seven priceFull StackAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
First problem is your JSON is missing a "
[{"memberID":2,"name":"utires, inc.","addressLine1":"1street","addressLine2":null,"}]
                                                                             ^

Open in new window

Julian HansenCommented:
Not sure how you were attempting to do but there were some oddities over and above the JSON.

For instance
member in members

Open in new window

But you have
$scope.getmemberlist = value

Open in new window

The latter is being used as an array but is not being setup as such.

Your controller does not seem to match the binding
<div class="col-md-7"  ng-controller="cvGetMemberListGrid">

Open in new window

app.controller('cvGetMem', function ($scope, $http, toastr, memberRepository) {

Open in new window

cvGetMem <> cvGetMemberListGrid

Here is a working sample - code below.
<!-- SOURCE LISTING ACTIVE -->
<!doctype html>
<html>
<head>
<title>Test</title>
<link href="css/bootstrap.css" rel="stylesheet" />
<style type="text/css">
</style>
</head>
<body>
<div class="container">
  <h4>Angular: Fetch data by JSON into a Repeater</h4>
  <h5>Author: Julian Hansen, August 2015</h5>

  <div ng-app="app">
    <div>
      <div class="well"><h4>Edit Members</h4></div>
    </div>
    <div class="row">
      <div class="col-md-7"  ng-controller="cvGetMemberListGrid">
         {{members}}
        <div  style="margin-bottom:150px;">
          <div class="form-group">
            <label class="col-lg-2 control-label" style="white-space: nowrap; font-size:22px; padding-bottom:50px;">Select Member</label>
            <div class="col-lg-7">
              <select class="form-control"  id="select"   ng-model="ame" ng-options="item.memberId as item.name for item in members">
                <option value="">---Please select---</option> 
              </select>
            </div>
          </div>
        </div>
        <hr />
        <div>
          <div>
            <div class="input-group" style="  padding-left:210px;">
              <input type="text" class="form-control" placeholder="Search" ng-model="searchText" name="searchText" id="searchText">
              <div class="input-group-btn">
                <span class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></span>
              </div>
            </div>
            <table id="table-pagination" data-search="true" class="table table-striped table-hover table-condensed"  data-pagination="true" >
              <thead>
                <tr>
                <th>Member Name</th>
                <th>&nbsp;</th>
                <th>&nbsp;</th>
                <th>&nbsp;</th>
              </tr>
            </thead>
              <tr ng-repeat="member in getmemberlist  | filter:searchText ">
                <td>
                  {{member.name}}
                </td>
                <td>
                </td>
              </tr>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div><script src="js/psource.js"></script>
</div>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="js/bootstrap.js"></script>
<!-- START "jQuery Listing" -->
<script>
var app= angular.module('app',[]);

app.controller('cvGetMemberListGrid', function ($scope, $http) {
  $http.get('t1034.txt').
    then(function(response, status, headers, config) {
      $scope.getmemberlist = response.data;
    },
	function(response) {
		// handle errors here
	}
  );
});
</script>
<!-- END -->

</body>
</html>

Open in new window

JSON File
[{"memberID":2,"name":"utires, inc.","addressLine1":"1street","addressLine2":"null,"}]

Open in new window

Julian HansenCommented:
Also note that the .success function has been deprecated in favour of .then

https://docs.angularjs.org/api/ng/service/$http#deprecation-notice

How to use with .get()
https://docs.angularjs.org/api/ng/service/$http#get

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Seven priceFull StackAuthor Commented:
thanks. also I added Json.parse and it worked well. Thanks again.
Julian HansenCommented:
You are welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSON

From novice to tech pro — start learning today.