通过restangular获取布尔响应(GET boolean response through restangular)
我已经使用Jersey创建了一项休息服务。 该服务允许用户检查用户名是否已经可用或已被某人使用。
http://localhost:8080/rest/user/checkUname/uname这返回true或false,它工作正常。
现在在我的用户界面中,我尝试在Angularjs中使用Restangular,其代码如下所示
var userBaseUrl = Restangular.all('user'); var valid = userBaseUrl.one('checkUname',uname).get();但'有效'没有布尔值。
正如我在调试中看到的,所有执行都正常工作。
如何通过Restangular访问布尔响应?
I have created a rest service using Jersey. The service allows user to check if the username is already available or has been used by someone.
http://localhost:8080/rest/user/checkUname/unameThis returns true or false and it works fine.
Now in my UI I am trying to use the Restangular in Angularjs where my code is as follow
var userBaseUrl = Restangular.all('user'); var valid = userBaseUrl.one('checkUname',uname).get();But 'valid' does not have a boolean value.
All the executions are working proper as I see in the debugging.
How do I access a boolean response through Restangular ?
最满意答案
尝试做到这一点:
Restangular.all('user').one('checkUname', uname).get().then( function (valid) { //check here } )try to do this:
Restangular.all('user').one('checkUname', uname).get().then( function (valid) { //check here } )更多推荐
发布评论