Ich habe Daten in mysql i Umwandlung ist, dass als json URL codierte,Ist es möglich, JSON-Daten mit URL-Codierung zu bekommen?
ich AngularJS bin mit Daten zu holen dies ist mein unter AngularJS Code
Das ist mein Winkel Skript:
angular
.module('hameedApp', [])
.controller('hameedController', function($scope, $http) {
$http({
method: 'GET',
url: 'json2.php'
}).then(function(response) {
$scope.contacts = response.data;
}).catch(function(response) {
console.log('error');
})
});
Das ist mein json2.php Code:
<?php
$connect = mysqli_connect("localhost", "root", "", "recruiter");
$sql = "SELECT * FROM recruiter";
$result = mysqli_query($connect, $sql);
$json_array = array();
while($row = mysqli_fetch_assoc($result))
{
$json_array[] = $row;
}
echo print_r(json_encode($json_array));
?>
Wenn ich json2.php
in Postbote url treffen, erfolgreich i go t wie json Antwort,
Wenn ich {{contacts}}
in meine HTML-Datei, erfolgreich habe ich JSON Antwort, aber wenn ich ng-repeat {{contact.somestuff}}
, habe ich keine Daten erhalten. Irgendwelche Ideen ?
Sie brauchen nicht 'print_r'. Was siehst du in '{{contacts}}'? Zeige uns auch die 'ng-repeat' – charlietfl
hi @charlietfl ich bin hameed Freund, der auch in seinem Projekt arbeitet, in {{contacts}} er hat eine json Antwort –
zum Beispiel: {{name: gleich, Alter: 20} } das zeigt in html korrekt –