Open the console, what errors do you get? Move the console.log(data) to the success function. Does it get called and is data undefined.
Add an error callback with a console.log(). Does that run instead? If it because you're browsing on the file system, file:\\\index.html, CORS will be kicking in on Chrome. If you want to browse to the file and you don't have a webserver handy, but you do have Python installed, run this in the directory you wish to browse: python -m SimpleHTTPServer Adrian On 6 November 2014 11:23, t m <[email protected]> wrote: > I had the same issue running the Step 5 of Angular JSTutorial. It came > from my browser configuration (I was using Chrome) and just running the > index.html fole in Firefox solved the pb. SYnthesis : it may not come from > your code or environment but just the browser configuration. > > Le lundi 29 octobre 2012 14:52:02 UTC+1, Marit Rødevand a écrit : >> >> Hi, >> I am very new to Angular and Web development. >> >> I'm using http get on a json file in a controller, but I am unable to >> extract any information stored in the json file in the controller. >> It works perfectly fine to dislpay the information in the json file in a >> view, but I am unable to retrieve them in the controller to use them in >> functions. >> If I try to do console.log in the controller all i get is 'undefined'. >> >> e.g: >> >> $http.get('users/users.json').success(function(data) { >> $scope.users = data; >> >> console.log($scope.users.username); >> >> >> >> Is it impossible to use the information in the json file in the >> controller? >> >> If it is possible how do I get the information? >> >> Thanks in advance, >> Have a nice day! >> >> >> -- > 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. > -- 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.
