php - $http.get won't display in ionic framework -
hi new json , angular, have been struggling display data framework. blank page no error
this controller
.controller('petindexctrl', function($scope, petservice) { $scope.pets = petservice.all(); console.log($scope.pets); })
this factory
.factory('petservice', function($http, $ionicplatform) { var markers = []; return { all: function(){ return $http.get("https://192.168.1.10/getevent.php").then(function(response){ markers = response; return markers; }); } } });
this ionic framework
<scrip id="pet-index.html" type="text/ng-template"> <ion-view title="'rooms'"> <ion-content has-header="true" has-tabs="true"> <ion-list> <ion-item ng-repeat="pet in pets" type="item-text-wrap" href="#/tab/pet/{{pet.id}}"> <h3>{{ pet.prof }}</h3> </ion-item> </ion-list> </ion-content> </ion-view> </script>
this php
$mysqli = new mysqli("localhost", "root", "", "info"); $result = "{'success':false}"; $query = "select * viewsched"; $dbresult = $mysqli->query($query); $markers = array(); while($row = $dbresult->fetch_array(mysqli_assoc)){ $markers[] = array( 'prof' => $row['professor'], 'sub' => $row['subject'], 'time' => $row['time'], 'room' => $row['room'], 'day' => $row['day'] ); } if($dbresult){ $result = json_encode($markers); } else { } header('access-control-allow-origin: *'); header('access-control-allow-methods: get, post, options'); header('access-control-allow-headers: content-type,x-prototype-version,x- requested-with'); echo($result);
i've tried , still no data being displayed. can me. thanks
this caught attention
<scrip id="pet-index.html" type="text/ng-template">
should
**<script id="pet-index.html" type="text/ng-template">**
Comments
Post a Comment