javascript - Ng-repeat doesn't show data -
I'm very new to Angular JS and at the moment I'm learning PHP rental service with Engels. I had a problem, why was my response data in NG-DROP?
This code structure is:
& lt; html ng-app = "ngTest" & gt; & Lt; Top & gt; & Lt; Title & gt; Angular Test & lt; / Title & gt; & Lt; Script type = "text / javascript" src = "http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "https://code.angularjs.org/1.0.7/angular-resource.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; div ng-controller = "getctrl" & gt; & Lt; Ul & gt; & Lt; li ng-repeat = "User in User" & gt; {{User.email}} & lt; / li & gt; & Lt; / Ul & gt; & Lt; / Div & gt; & Lt; Script type = "text / javascript" & gt; Var ngTest = angular.module ('ngTest', []); NgTest.factory ('GetFactory', function ($ http) {var user = []; var factory = {}; factory.getusers = function () {$ http.get ('api / get.php'); Users Return;}; return factory;}); NgTest.controller ('GetCtrl', function ($ radius, GetFactory) {$ scope.users = GetFactory.getUsers ();}); & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt; PHP code includes Dummy Basic Jason response data:
'admin321',); $ Jsonen = json_encode ($ dummy data); Print_r ($ jsonen); ? & Gt; What's wrong here?
Update : Please answer the coded. Thank you.
No $ data variable is not defined. It should be
$ jsonen = json_encode ($ dummyData); Instead of
$ jsonen = Json_encode ($ data);
Comments
Post a Comment