My RestController :
@RestController public class TeacherRestController { private static final String TEACHER_MODEL = "teacher"; @Autowired TeacherService teacherService; @GetMapping("/rest/teachers/getAll") public List<Teacher> getAllTeachers() { return teacherService.getAll(); } } Model Teacher :
@Entity @ToString @Setter @Getter @NoArgsConstructor @AllArgsConstructor @Table(name = "teachers", schema = "public") public class Teacher { @Id @Column(name="teacher_id") @GeneratedValue(strategy = GenerationType.IDENTITY) private int teacherId; @Column(name = "teacher_name") @NotNull @Size(min = 4,max = 75,message = "Teacher name should be not less than 4 symbols and not more than 75 symbols!") private String teacherName; @Column(name = "position") @NotNull @Size(min = 3,max = 50,message = "Teacher position should be not less than 3 symbols and not more than 50 symbols!") private String position; My index.html :
And angular.js :
var app = angular.module("myApp", []); app.controller('myCtrl', function ($scope, $http) { $http.get('http://localhost:8081/rest/teachers/getAll') .then(function(response) { $scope.myWelcome = response.data; }); }); On index.html teachers doesn't show, but on this address http://localhost:8081/rest/teachers/getAll I have teachers in JSON.


teacherobject set on the$scope