Custom controller not retrieving all data
-
I’m creating an angular page that dynamically displays quotes from authors. I’ve tried a few things so far, but no luck. Here is my latest code:
Controller
quotesApp.controller('QuotesController', ['$scope', '$http', function($scope, $http) { $http.get($scope.api + '/quotes_app/').success(function(data) { $scope.quotesList = data; }).error(function(data) {}); }]);Core.php
class JSON_API_Core_Controller { public function quotes_app() { global $wpdb; $rows = $wpdb->get_results("SELECT * FROM quotestable"); foreach( $rows as $key => $row) { $quote = $row->quote; $author = $row->author; return array( 'quote' => $quote, 'author' => $author ); } }View
li ng-repeat="q in quotesList">{{q.quote}} - {{q.author}}</li>It seems the view doesn’t recognize the array in the quotes_app() function.
Any ideas?
Thanks
The topic ‘Custom controller not retrieving all data’ is closed to new replies.