Answer the question
In order to leave comments, you need to log in
Angular how to solve problem with $http?
Just starting to learn angular and ran into a problem. Here is the client code:
angular.module('NewAppModule', []);
angular.module('NewAppModule')
.component('div', {
template:
... ,
controller: [ '$scope', '$http',
function ($scope, $http){
$scope.url='app.json';
$http({url: $scope.url, method:'GET'}).then(function(response) {
console.log(response.data);
});
}
]
});
{
'name' : 'Василий',
'number': '89201242536'
},
{
'name' : 'Николай',
'number': '89201265341'
},
{
'name' : 'Федор',
'number': '89031212434'
},
{
'name' : 'Всеволод',
'number': '89991201344'
},
{
'name' : 'Алексей',
'number': '89605663412'
},
{
'name' : 'Алена',
'number': '89144542106'
},
{
'name' : 'Ксюша',
'number': '89301612726'
},
{
'name' : 'Василиса',
'number': '89201441596'
},
{
'name' : 'Евгений',
'number': '89105722534'
},
{
'name' : 'Анатолий',
'number': '89208796712'
}
]
SyntaxError: Unexpected token ' in JSON at position 6.
Answer the question
In order to leave comments, you need to log in
can first figure out elementary json, and then climb into angular
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question