这段代码工作正常.
我想要的唯一改进是 - 当我传递"Pi"时,它会获取以名称"Pi"开头的所有项目对象,但是当我输入"pi"时它什么都不返回!
这意味着我希望这种方法startAt(itemName)不区分大小写.所以这应该适用于任何事情(小写或大写),在这种情况下"Pi"或"pi"等.
//5. Get menu items from RestaurantMenu
this.getMenuItemFromRestaurantMenu = function(callback, itemName) {
var ref_restMenu = firebase.database().ref()
.child('Restaurants')
.child('Company')
.child('menu');
//Check if item is already exist!
ref_restMenu.orderByChild("itemName").startAt(itemName).once("value", function(snapshot) {
var data = snapshot.val();
if(data !== null) {
//We will ger item name and restaurant id from this data.
callback(data);
} else {
//Item not found in globalMenu
console.log("%c Item not found in Global Menu", "color: red");
}
});
}
Run Code Online (Sandbox Code Playgroud) 我正在寻找有关在 Java 中使用 Firebase(作为数据库)的信息。这是否可以与通过 Firebase 托管托管 Java(使用 Spring 框架)项目一起实现。
我试过了\n 和 <br />,但遗憾的是没有工作!
这可能吗 ?
//Displaying toast to welcome user!
let user = this.currentUser();
//console.log(user);
let toast = Toast.create({
message: 'Hi ' + user.email + '! <br/> Welcome to My App',
duration: 5000,
position: 'bottom'
});
toast.onDismiss(() => {
console.log('Dismissed toast');
});
this.nav.present(toast);Run Code Online (Sandbox Code Playgroud)
致命错误:CALL_AND_RETRY_LAST分配失败 - JavaScript堆内存不足
运行命令时出错:ionic cordova build android --prod
注:该离子构建Android,离子运行的Android和离子成为一切工作正常.
我读过许多话题,说一旦项目变大,就会停止工作.
它是在问题到来前一天工作的.它停止工作,因为我们添加了更多的文件和JSON,用于多语言的应用程序翻译.
这是一个已知的问题吗?有什么解决方案吗?
请检查更多细节:https://youtu.be/oCN7iSt8rzg
附加错误图片:
离子信息:
firebase.auth().onAuthStateChanged((user) => {
if(user) {
this.isLoggedIn = true; //Set user loggedIn is true;
this.isAdmin = false;
firebase.database().ref('/userProfile/' + user.uid).once('value').then(function(snapshot) {
let userInfo = snapshot.val();
if(userInfo.isAdmin == true) {
//ERROR AT THIS LINE:
//Error: Uncaught (in promise): TypeError: Cannot set property 'isAdmin' of null
this.isAdmin = true;
console.log(userInfo);
}
});
} else {
this.isLoggedIn = false; //Set user loggedIn is false;
}
});
Run Code Online (Sandbox Code Playgroud)
我在第8行遇到错误
错误:未捕获(在承诺中):TypeError:无法将属性'isAdmin'设置为null
firebase firebase-authentication firebase-realtime-database angular
我在离子项目中使用离子标签,但描述没有显示(而是显示点点.. ..)我希望它显示整个文本..有什么解决方案吗?
<ion-card *ngFor="let product of products">
<img [src]="product.imageURL" />
<ion-card-content>
<ion-card-title primary [innerHTML]="product.title"></ion-card-title>
<ion-item class="item-text-wrap">
<ion-item>
<ion-label primary>Description</ion-label>
<ion-label [innerHTML]="product.description"></ion-label>
</ion-item>
</ion-card-content>
</ion-card>
Run Code Online (Sandbox Code Playgroud)
我不想使用for循环将Object转换为数组!如果加倍过程并降低app的性能(我使用Ionic2和Typescript,使用Firebase)
for(let key in data){array.push(value); }
是否有使用*ngFor迭代对象本身的解决方案(如附图所示).
或者我可以将此Object(如附图所示)转换为Array,以便可以在*ngFor中进行迭代.
我在我的代码中试过这个:
import {NavController, AlertController, Toast, Loading} from 'ionic-angular';
然后在构造函数中:
constructor(public nav: NavController, public authData: AuthData,
public adminData: AdminData, public formBuilder: FormBuilder,
public alertController: AlertController) {
Run Code Online (Sandbox Code Playgroud)
但是,我在控制台上遇到了这个错误!
project_directory/node_modules /离子 - 角/索引
没有导出成员'AlertController'
我想从Class2的其他方法调用Class1的方法 - sometMethod()
怎么可能?
两个类都存在于相同的Typescript中.
export class Class1 {
constructor(public nav: NavController, public formBuilder: FormBuilder, public viewCtrl: ViewController) {
this.nav = nav;
}
sometMethod() {
console.log("someMethod of Class1");
}
}
export class Class2 {
constructor(public nav: NavController, public formBuilder: FormBuilder, public viewCtrl: ViewController) {
this.nav = nav;
}
sometOtherMethod() {
console.log("someOtherMethod of Class2");
//I want to call a method of Class1 - sometMethod()
//How is that possible?
//Class1.someMethod(); //Does not Worked!!
}
}
Run Code Online (Sandbox Code Playgroud) Firebase 托管工作正常!但这在两种情况下显示找不到页面(附有图像)页面:
注意:该页面是使用 Polymer Web Components 设计的。
检查此链接 - https://yesitesapp.com/products
请提出建议 - 如果需要任何配置或任何设置才能正常运行 Firebase 托管。