在Cloudant与角访问DB [英] Accessing the DB in Cloudant with Angular

查看:138
本文介绍了在Cloudant与角访问DB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图连接到一个Cloudant DB。我从一个JSON创建数据库,并上传到这里Cloudant: DeanRadar

I am attempting to connect to a DB on Cloudant. I created the DB from a JSON and uploaded it to Cloudant here: DeanRadar

我复制了字节的信息字节到我的服务器包括_id和_rev另一个JSON。如果我所说的JSON直接它工作正常,但我不能得到code在工作的时候输入上面给出的URL。

I copied the info byte for byte into another JSON on my server including the "_id" and "_rev". If I call the JSON directly it works fine, but I can not get the code to work when I enter the URL given above.

我猜的网址只是一个占位符,它被返回给我的浏览器一样,它应该有它的结束或东西是以.json,浏览器可以阅读,但不是解决之前code。我不知道有足够的了解Cloudant,沙发,角,等知道我在找。我已经做了很多的PHP / SQL数据库,但是这是我与cloudant /杰森/棱角分明。

I am guessing the URL is just a place holder and it gets resolved before returning it to my browser, like it is supposed to have a ".json" on the end of it or something that the browser can read but not the code. I do not know enough about Cloudant, Couch, angular, etc to know what I am looking for. I have done plenty of PHP/SQL databases but this is my first attempt with cloudant/jason/angular.

下面是有问题的code(忽略我宣布dbURL两倍的事实,它的存在表明我已经使用了什么)

Here is the code in question (ignore the fact that I declare dbURL twice, it is there to show what I have used)

var dbURL = 'https://deanradar.cloudant.com/tempdata/80d7d28d9e96778ad3bf4531817ab190';
var dbURL = 'data/tempData.json';
                $http.get(dbURL).success(function(data) {
                    tempDataDeferred.resolve(data);
                });

这工作,当我访问我的JSON服务器从cloudant DB复制,但调换dbURL线(访问的cloudant DB的直接URL)返回任何内容。你可以采取同样的网址,然后拍打到浏览器地址栏显示的信息正是因为它坐落在JSON。

This works, when I access the JSON on my server copied from the cloudant DB, but swapping the dbURL lines (accessing the direct URL for the cloudant DB) returns nothing. You can take that same URL and slap it into your browser address bar and see the info exactly as it sits in the JSON.

拼抢[API URL +]的地址并没有帮助,它甚至不会解决浏览器。任何想法,我需要做什么来访问数据库?

Grabbing the "[API URL+]" address doesn't help, it won't even resolve in the browser. Any idea what I need to do to access the DB?

推荐答案

检查该文件

https://cloudant.com/for-developers/crud/#browser-更新

虽然例子,他们使用jquery.couch您可以检查原来的code和它应用到你angularjs应用

although in examples they are using jquery.couch you can check the original code and apply it to your angularjs app

这篇关于在Cloudant与角访问DB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆