Link to home
Start Free TrialLog in
Avatar of Seven price
Seven priceFlag for United States of America

asked on

angularjs foreach

I only want to ge the first value only. either break the loop once the value is found or another way to retrieve the first value only.
.success(function (data, status, headers, config) {
                        $scope.myData = data;
angular.forEach($scope.myData, function (item) {
                           // $scope.mypage = item.GroupID
                         
                               alert(item.GroupID);
                               return false;
                       
                       })
ASKER CERTIFIED SOLUTION
Avatar of Ioannis Paraskevopoulos
Ioannis Paraskevopoulos
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Seven price

ASKER

alert(data[0].GroupID);
thanks