Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49518

How to display user details with ionic ngResource

$
0
0

@MohammedSalah wrote:

Hello,

I am using ngResource to make login page by phone number and i want to show user details after successful login but i can't make ng-repeat with response

My Controller

.factory('Post', function($resource) {
  return $resource('api/view_order',{phone: "@phone"});
})
.controller('ViewCtrl', function($scope, Post, Authorization, $state, $ionicLoading) {
  $scope.postData = Authorization;

  $scope.loading = $ionicLoading.show({
    template: '<img src="img/294.gif">',
    showBackdrop: true,
    showDelay: 10
  });

  $scope.posts = Post.query(function(data){
    $scope.post = data[0];
  })

  $ionicLoading.hide();

  $scope.postData = {};
  $scope.newPost = function() {
    var post = new Post($scope.postData);
    post.$save();
    $state.go('tab.account');
  }
$scope.postData = Authorization;

})

After successfully login response
[
{
"user_id": "1847",
"user_name": "MSalah",
"user_phone": "01012661102"
}
]

I want to show in account view user_name and user_phone

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49518

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>