Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>OK. Solved it. First, copied and added a controller I found in one of the examples:</p> <pre><code> function FetchCtrl($scope, $http, $templateCache) { $scope.method = 'GET'; $scope.url='../services/index.php'; $scope.fetch = function() { $scope.code = null; $scope.response = null; $http({method: $scope.method, url: $scope.url, cache: $templateCache}). success(function(data, status) { $scope.status = status; $scope.data = data; }). error(function(data, status) { $scope.data = data || "Request failed"; $scope.status = status; }); }; $scope.updateModel = function(method, url) { $scope.method = method; $scope.url = url; }; } </code></pre> <p>Then, I added a route controller to my module:</p> <pre><code>var module = angular.module('Cats', ['ngResource','Cats.filters', 'Cats.services', 'Cats.directives']) .config(['$routeProvider', function($routeProvider) { $routeProvider.when('/main', {templateUrl: 'partials/partial1.html', controller: MyCtrl1}); </code></pre> <p>Finally, on that partial1.htm page, I added this:</p> <pre><code>&lt;div ng-init="fetch()"&gt; {{data}} &lt;/div&gt; </code></pre> <p>Now when I go to that page in the browser, I can see the entire database dumped out in JSON. Ahhhh. Clearly there are many more sophisticated things to try, etc etc but I needed this simple result so I could be certain that I did in fact have a model arriving when summoned. Angular dies silently in many cases, so a visible result was quite helpful.</p> <p>One gotcha: be careful that the php file is executable by more than yourself as user. I don't know the name of the user that AngularJS implements but I had to <code>chmod 644 index.php</code> so the app could use it.</p> <p>I hope that helps someone.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload