As a newcomer to angularjs, I am in the process of building an app where the output is already set up correctly. However, I am looking to achieve the same without relying on jQuery, and instead want to utilize the angularjs method using "ng-repeat".
Below is the code snippet from my controller:
.controller('SomeListCtrl', function(SomeFromService, $scope, $stateParams, $http){
var encodedString = 'action=' +
encodeURIComponent("getSomething") +
'&count=' +
encodeURIComponent("10") +
'&page=' +
encodeURIComponent("1");
$http({
method: 'POST',
url: 'http://service.something/site.aspx',
data: encodedString,
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
})
.success(function(data){
$scope.myData = data;
})
.error(function(data, status){
console.log(status);
})
})
Here is the part of my html where I need to implement it:
<ion-view view-title="Latest News">
<ion-content>
<ion-list>
<ion-item class="item-remove-animate item-avatar item-icon-right" ng-repeat="data as myData" type="item-text-wrap" href="#/tab/myLink/{{data.id}}">
<img ng-src="http://the-v.net{{data.ImageLink}}">
<h2>{{data.localTitle}}</h2>
<i class="icon ion-chevron-right icon-accessory"></i>
</ion-item>
</ion-list>
</ion-content>
</ion-view>
Just a note, the JSON data returned by the ajax call is structured like this:
[{
"id": "5f6e8bac-197f-4ae3-8535-6d892a101d17",
"localTitle": "Public"
}]