var data  = 
[{"ModelNum":"KD-A305","Year":"2008","Price":129.95,"Pic":"kd-a305prodPic3.jpg"},{"ModelNum":"KD-A315","Year":"2010","Price":129.95,"Pic":"KD-A315prodPic1.jpg"}]

When I use this variable everything works in Angular.


But when I try stuffing it in a $scope:

var data = JSON.parse($scope.jvcModels);

Error: JSON.parse: unexpected character at line 1 column 2 of the JSON data


Service

$scope.jvcModels = myDataService.FetchJVCModels();

Factory

app.factory('myDataService', function ($http,$q) {

    return {

        FetchJVCModels: function () {

            //var promise = 
$http.post('AngularWithWebServices.aspx/FetchJVCModels', { data: {} 
}).then(function (response) {
            var promise = 
$q.all($http.post('AngularWithWebServices.aspx/FetchJVCModelsB', { data: {} 
}).then(function (response) {

                //console.log(response);

                return response.data;
            }));

            return promise;

        },

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to