Hello,
I want to show select list in angular js
Data is in .php file in json format as below:
["{\"0\":\"949\",\"user_id\":\"949\",\"gslab_id\":\"GS-0835\"}","{\"0\":\"493\",\"user_id\":\"493\",\"gslab_id\":\"GS-0451\"}","{\"0\":\"338\",\"user_id\":\"338\",\"gslab_id\":\"GS-0322\"}","{\"0\":\"961\",\"user_id\":\"961\",\"gslab_id\":\"GS-0843\"}","{\"0\":\"444\",\"user_id\":\"444\",\"gslab_id\":\"GS-0409\"}"]

what I have written till is
in my index.php file:

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
<script src="myNoteApp.js"></script>

<body ng-app="mainApp">
    <div ng-controller="mainController">
        <select>
            <option ng-repeat="category in content" value="{{category.user_id}}">
                {{category.user_id}}
            </option>
        </select>
     </div>
</body>

And in myNoteApp.js file:

var myapp = angular.module('mainApp', []);
myapp.controller('mainController',function($scope,$http){
    $scope.content = null;
    $http({method: 'GET', url: 'allemployee.php'}).
        success(function(data, status, headers, config) {
            $scope.contents=data;
        }).error(function(data, status, headers, config) {          
    });
});
// allemployee.php file is php file containing json data  

but it is not showing select values.
Where am wrong in this?

NOTE: @Admin, I did not see posts section for Angular JS. Request you to move it in that section if it is ut in wrong one.

And if you change $scope.contents to $scope.content?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.