有人告诉我在我的数据库中使用蛇形案例,而不是骆驼案例。JSON API 说在单词之间使用破折号作为对象键。Javascript,大家都用camelCase。
如果我有一个 RAILS 服务器从 SQL 数据库获取数据,将其作为 json 发送并在 javascript 中使用,我真的需要在这些符号之间进行转换吗?
为什么不到处使用蛇盒?
我一直试图找出这个代码意味着什么,但我没有运气,甚至找不到从哪里开始或查找什么.
if(!/^(https?):\/\//i.test(value))
Run Code Online (Sandbox Code Playgroud)
我理解其中一些所以我有以下问题.
如果这似乎是一个没有研究的问题,任何从哪里开始的指导都会很棒.
我正在学习AngularJS和Firebase并使用AngularFire 0.8.2(老我知道).我想要一个函数(getAccount)从firebase返回一个与initAccount相同的数组.firebase URL工作但我不知道如何使函数返回数组.任何帮助,将不胜感激 :)
app.service('DataService', function(FURL, $firebase) {
var ref = new Firebase(FURL);
//initial account array to load
this.account = [
{'info':'Sig1'},
{'info':'Sig2'},
{'info':'Sig3'}
];
this.getAccount = function(user) {
var uid = user.uid;
var dir = 'profile/' + uid + '/account';
var accountSigs = $firebase(ref.child(dir)).$asArray().$loaded().then(function(response) {
//show response returns [[object Object],[object Object],[object Object]] with correct data as it should.
console.log('show response: [' + response + ']');
return response;
});
// this returns [[object Object]] but I don't know why
console.log('show …Run Code Online (Sandbox Code Playgroud) javascript ×2
angularjs ×1
camelcasing ×1
firebase ×1
json ×1
loaded ×1
regex ×1
shorthand ×1
sql ×1