将Firebase网址存储在外部属性文件中? [英] Store Firebase url in an external properties file?

查看:39
本文介绍了将Firebase网址存储在外部属性文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将Firebase网址放入外部文本文件,并在Javascript文件中引用该值.

I want to put my Firebase url into an external text file and reference that value within my Javascript file.

当前在我的文件中我有var ref = new Firebase("https://<YOUR-FIREBASE-APP>.firebaseio.com");,但是我想要这个:var ref = new Firebase("https://" + fbAppName + ".firebaseio.com");

Currently in my files I have var ref = new Firebase("https://<YOUR-FIREBASE-APP>.firebaseio.com"); but I want this: var ref = new Firebase("https://" + fbAppName + ".firebaseio.com");

这是因为我不必每次将更改推送到github帐户时都将我的Firebase应用名称替换为<YOUR-FIREBASE-APP>.在外部文件中引用该URL会更容易,而只需将该文件添加到我的git ignore中即可.

This is so that I don't have to replace my Firebase app name with <YOUR-FIREBASE-APP> every time I push changes to my github account. I'd be easier to have the url referenced in an external file and just add that file to my git ignore.

推荐答案

您可以使用角度常数.参见示例

You could use an Angular Constant. See example

angular.module('app', []);

.value('movieTitle', 'The Matrix');

.controller('MyController', function (movieTitle) {
  expect(movieTitle).toEqual('The Matrix');
})

这篇关于将Firebase网址存储在外部属性文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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