I am trying to pass a json object from database to controller in angularjs I am new to angularjs and Don't know about syntax.
Asked
Active
Viewed 73 times
0
-
`$http.get(url).then(function(response){ $scope.json = response.data; });`. Assuming it's coming from PHP, it will have `echo json_encode($json);` – Aleksey Solovey Feb 12 '18 at 10:28
-
If the database is on a server, and you are fetching the JSON by AJAX, then store it in `$scope` – Mawg says reinstate Monica Feb 12 '18 at 10:28
-
1Possible duplicate of [How to do a $http GET with some data in Angular?](https://stackoverflow.com/questions/32191502/how-to-do-a-http-get-with-some-data-in-angular) – Ramesh Rajendran Feb 12 '18 at 10:28
-
And please let me know where you want, In angularjs or angular? – Ramesh Rajendran Feb 12 '18 at 10:30
-
What Ramesh meant is: you are either using AngularJs (v1.x) or Angular (v2+) but it can't be both, and it's not clear from your post. – Adrien Brunelat Feb 12 '18 at 10:34
-
Thanks for your Suggestions I have done it :-) – Arti Feb 14 '18 at 09:02