本文整理汇总了TypeScript中angularfire2.FirebaseObjectObservable类的典型用法代码示例。如果您正苦于以下问题:TypeScript FirebaseObjectObservable类的具体用法?TypeScript FirebaseObjectObservable怎么用?TypeScript FirebaseObjectObservable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FirebaseObjectObservable类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: saveMovie
saveMovie(movie: IMovie) {
console.log(movie.movieId);
// Have to always get the current data first?
const item: FirebaseObjectObservable<IMovie> =
this.af.database.object('movies/' + movie.movieId);
return item.update({title: movie.title});
}
示例2: get
get(key) : Observable<T> {
let observer : FirebaseObjectObservable<T> = this.af.database.object(this.endpoint + key);
return observer.map(item => {
item.$key = key;
return item
});
}
示例3: update
update( wordRef: FirebaseObjectObservable<any>, child:string, key:string, value:Object ) {
wordRef.update(
{[child]: {key: value}}
)
.then(_ => console.log("Update Size: OK"))
.catch( e => console.log("Update Size: Fail"));
}
示例4: editClass
editClass(classTObservable: FirebaseObjectObservable<IClassT>, classT: ClassT) {
return classTObservable.update({
name: classT.name,
professor: classT.professor,
timeSchedule: (classT.timeSchedule === undefined ? new HourDate() : classT.timeSchedule),
});
}
示例5: constructor
constructor(public platform: Platform, public navCtrl: NavController, public user:User, public push: Push, public navParams: NavParams, storage: Storage, public af: AngularFire, public loadingCtrl:LoadingController) {
// CARICA TUTTE LE GARE NEL DATABASE
let loader = this.loadingCtrl.create({
content: "Attendere il caricamento delle gare..."
});
loader.present();
this.gare = af.database.object('/gare', { preserveSnapshot: true });
this.gare.subscribe(snapshot => {
storage.set('gareDB', snapshot.val());
this.navCtrl.setRoot(Page1)
});
this.gare.subscribe(() => loader.dismissAll());
if (this.platform.is('android')) {
this.push.register().then((t: PushToken) => {
return this.push.saveToken(t);
}).then((t: PushToken) => {
this.notificheSnap = this.af.database.object('/utenti/'+this.user.id+'/notifiche/', { preserveSnapshot: true });
this.notificheSnap.set({pushToken:t.token});
});
}
}
示例6: exportCSV
exportCSV() {
var dataString = "heyjoheyjoheyjoheyjo";
var data = [];
var filename = "";
this.poll.subscribe((snap: any) => {
if (snap.options !== undefined) {
filename = snap.name.split(' ').join('') + ".results";
for (let obj of snap.options) {
data.push([obj.value, obj.score]);
}
data.push(['Total', this.total]);
}
});
var csvContent = "data:text/csv;charset=utf-8,";
data.forEach(function(infoArray, index){
dataString = infoArray.join(",");
csvContent += index < data.length ? dataString+ "\n" : dataString;
});
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", filename+".csv");
document.body.appendChild(link); // Required for FF
link.click(); // This will download the data file named "my_data.csv".
}
示例7: constructor
constructor(af:AngularFire, renderer: Renderer){
this.URL = window.location.href;
this.onOff = af.database.object('/'+this.URL.split('/game/')[1]+'/Globals/OnOff',{preserveSnapshot:true});
this.onOff.subscribe(snapshot =>{
this.environmentSnapshot = snapshot.val();
});
this.environment = af.database.object('/'+this.URL.split('/game/')[1]+'/Globals/Environment');
this.players = af.database.object('/'+this.URL.split('/game/')[1]+'/Players',{preserveSnapshot:true});
this.players.subscribe(snapshot =>{
this.playersSnapshot = snapshot.val();
});
/* Gets keyup */
this.getKey = renderer.listenGlobal('document', 'keyup', (event) => {
var key = event.keyCode;
this.toggleBtn(key);
});
}
示例8:
this.timerSubscription = timer.subscribe(t=>{
if(t <= this.gameClock.duration){
this.gameClock.ticks = t;
this.firebaseServer.update({Timer:this.gameClock.duration-this.gameClock.ticks});
} else {
this.stopClock();
}
})
示例9:
listPlaces(name, cat, add, lat, lng, placeID, uid, username ) {
let places = this.af.database.object(`/goaf-list-places/${placeID}`);
let thisgeo = {
latitude: lat ,
longitude: lng
};
let openTime = {
Monday: {
status: 'true',
openTime: '09:00',
closeTime: '17:00'
},
Tuesday: {
status: 'true',
openTime: '09:00',
closeTime: '17:00'
},
Wednesday: {
status: 'true',
openTime: '09:00',
closeTime: '17:00'
},
Thursday: {
status: 'true',
openTime: '09:00',
closeTime: '17:00'
},
Friday: {
status: 'true',
openTime: '09:00',
closeTime: '17:00'
},
Saturday: {
status: 'true',
openTime: '09:00',
closeTime: '17:00'
},
Sunday: {
status: 'true',
openTime: '09:00',
closeTime: '17:00'
}
}
return places.set({
placeID: placeID,
placeName: name,
placeCat: cat,
placeAdd: add,
authorID: uid,
author: username,
rating: 0.5,
website: "no_website",
pPhone: "no_phone",
openHours: openTime,
geometry: thisgeo,
listDate: firebase.database.ServerValue.TIMESTAMP
});
}
示例10: updateUser
updateUser(user) {
console.log("Propagating update back to fb",user);
let key = user.$key;
let value = user.$value;
delete user.$key;
delete user.$value;
this.updatableUser.update(user);
user.$key = key;
}