Here is my Code,
<div class="list card" ng-repeat="chat in dash" >
<div class="item item-avatar">
<img src="{{chat.FeedDtl.PhotoPath}}">
<h2>{{chat.FeedDtl.DisplayName}}</h2>
<p>Date</p>
</div>
<div class="item item-body">
<img class="full-image" src="{{chat.FeedDtl.MediaPath}}">
<p>{{chat.FeedDtl.FeedContent}}
</p>
<p>
<a href="#" class="subdued">1 Like</a>
<a href="#" class="subdued">5 Comments</a>
</p>
</div>
<div class="item tabs tabs-secondary tabs-icon-left">
<a class="tab-item" href="#">
<i class="icon ion-thumbsup"></i>
Like
</a>
<a class="tab-item" href="#">
<i class="icon ion-chatbox"></i>
Comment
</a>
<a class="tab-item" href="#">
<i class="icon ion-share"></i>
Share
</a>
</div>
</div>
Can anyone help on this?
please, format your code or make a codepen. And describe what is not working in the ngrepeat… what do you expect and what does happen.
i have formatted code, can u plz help me on that
.
console log your ‘dash’ var … I assume it’s a scope var?
yes it is scope var.
log is showing that, service is not found 404 error. (in android build).
but same service is working fine in web browser.
can u help on that?
I don’t know what you service does
How did you declared the scope var? code please
Controller.js
.controller(‘DashCtrl’, function($scope,dashService) {
dashService.getUsers().then(function(users){
$scope.dash=users;
}, function(err) {
console.log(‘ERR’, err);
})
})
Services.js:
.factory(‘dashService’, function($http) {
var users = [];
return {
getUsers: function(){
return $http.get(“http://hostname//Activity/GetActivityById?Id=3&FeedId=0&RowCount=5 ”).then(function(response){
users = response.data;
return users;
}, function(err) {
console.log(‘ERR’, err);
})
}
}
})
radha1258:
.controller(‘DashCtrl’, function($scope,dashService) { dashService.getUsers().then(function(users){ $scope.dash=users; }, function(err) { console.log(‘ERR’, err); })})
First I would suggest to declare the scope var first before using in your promise so
.controller('DashCtrl', function($scope,dashService) {
$scope.dash = null;
as for your service … the url
http://hostname//Activity/GetActivityById?Id=3&FeedId=0&RowCount=5
is your hostname a hostname on your local computer? I mean , the webserver serving the hostname and the app running in the browser are te same? If so , that might explain the device (not the emulator) cannot find the host.
I’ve also noticed
the promise of $http.get … the reject doesn’t have a return value … to be safe return false … even better use the $q pattern so you can resolve of reject back to the controller
https://docs.angularjs.org/api/ng/service/$q
I am using remote server url as hostname
well maybe the url is not whitelisted on the android device … so Android is blocking it …
or your browser has a custom dns entry to point to the host
Can you access the host from android with the device browser?