小编yed*_*dez的帖子

Spring Data Pageable:返回空内容

我是Spring Data和Spring MVC的新手,我不明白为什么我会得到空的内容:

@RequestMapping(value="/pages", method=RequestMethod.GET)
@ResponseBody 
public Page<Client> contactsPages(@RequestParam int page, @RequestParam int size) {
    Pageable pageable = new PageRequest(page, size, new Sort("id"));
    Page<Client> pageResult = clientRepository.findAll(pageable);

    return pageResult;
} 
Run Code Online (Sandbox Code Playgroud)

我测试网址时json的结果是:

{"content":[],"last":true,"totalElements":2,"totalPages":1,"size":5,"number":1,"sort":[{"direction":"ASC","property":"id","ignoreCase":false,"nullHandling":"NATIVE","ascending":true}],"first":false,"numberOfElements":0}
Run Code Online (Sandbox Code Playgroud)

如果您有使用Spring Data和Spring MVC以及AngularJS制作可分页请求的好示例; 这对我来说将是一个很大的帮助.

java spring spring-mvc spring-data spring-data-jpa

12
推荐指数
1
解决办法
9704
查看次数

$ rootScope在AngularJs中没有与我合作

我在我的函数中得到了我的$ rootScope的值但是我想在我的Controller的所有函数中得到thsi值以将它传递给另一个控制器:你能帮帮我吗

我的HTML:

<input type="checkbox"   ng-model="u.selected" data-ng-click="consoleClient(u)">
Run Code Online (Sandbox Code Playgroud)

我的脚本代码:

$scope.client = {
    id : null,
    nom : '',
    nberPhone : '',
    adresse : '',
    selected : false
};

$scope.consoleClient = function(client) {
    $rootScope.test = client;

    console.log(" lll "+$rootScope.test);
};
console.log(" aaaa "+$rootScope.test);
Run Code Online (Sandbox Code Playgroud)

控制台日志返回正确的结果但是第二个Out函数返回undefined.你能解释一下我的原因吗?

javascript angularjs

4
推荐指数
1
解决办法
2123
查看次数