本文整理汇总了TypeScript中angularfire2/angularfire2.FirebaseListObservable类的典型用法代码示例。如果您正苦于以下问题:TypeScript FirebaseListObservable类的具体用法?TypeScript FirebaseListObservable怎么用?TypeScript FirebaseListObservable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FirebaseListObservable类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getNewTaskListID
/**
* Generates and returns a unique id for a task list.
* @returns {string}
*/
private getNewTaskListID(): string {
let taskLists: FirebaseListObservable<any[]> =
this.angularFire.database.list(TASK_LIST_METADATA_PATH);
return taskLists.push(null).key;
}
示例2: saveEvent
saveEvent(event: EventModel): EventModel {
if (!event) {
return null;
}
if (event.$key) {
this.events$.update(event.$key, _.omit(event, ['$key', '$exists']));
} else {
this.events$.push(event);
}
return event;
}
示例3: saveTrack
saveTrack(track: TrackModel, kml?: string): TrackModel {
// Should save a new KML or keep existing ?
let kmlObject = {};
if (kml) {
console.debug('Saving a new KML', kml);
kmlObject = {kml: this.saveKml(kml).key};
}
const newTrack: TrackModel = Object.assign(
{},
track,
kmlObject);
if (newTrack.$key) {
console.debug('Update track');
this.tracks$.update(newTrack.$key, _.omit(newTrack, ['$key', '$exists']));
} else {
console.debug('Create a new track');
this.tracks$.push(newTrack);
}
return newTrack;
}
示例4: save
save(name:string,
length:string,
key:string,
tempo:string,
artist:string,
genre:string,
lyrics:string,
notes:string,
other:string
){
if(this.isNew === true){
//this.artists.map( artists => artists.filter(artist => artist.name === artist.name));
var newItemKey = this.songs.push({name:name,length:length,key:key, tempo:tempo,lyrics:lyrics, uid:this.uid}).key;
}
else
{
this.getOrCreateArtist(artist).then(
function(result){
var artistKey;
if(result){
artistKey = result['$key'];
}
else{
artistKey = this.artists.set({name:artist}).key;
}
/*const user = this.af.database.object(`users/${login}`);
user.subscribe(data => {
if(data.$value !== null) {
console.log('User does not exist');
} else {
console.log('User does exist');
}
});*/
this.song.update({name:name,length:length,key:key, tempo:tempo, lyrics:lyrics, artistId:artistKey});
}
);
}
this.router.navigate(['/songs']);
}
示例5: function
function(result){
var artistKey;
if(result){
artistKey = result['$key'];
}
else{
artistKey = this.artists.set({name:artist}).key;
}
/*const user = this.af.database.object(`users/${login}`);
user.subscribe(data => {
if(data.$value !== null) {
console.log('User does not exist');
} else {
console.log('User does exist');
}
});*/
this.song.update({name:name,length:length,key:key, tempo:tempo, lyrics:lyrics, artistId:artistKey});
}
示例6: deleteTrack
deleteTrack(track: TrackModel): void {
if (track.kml) {
this.removeKml(track.kml);
}
this.tracks$.remove(track.$key);
}
示例7: removeKml
removeKml(kml: string) {
this.kmls$.remove(kml);
}
示例8: saveKml
saveKml(kml: string): firebase.database.ThenableReference {
return this.kmls$.push(kml);
}
示例9: deleteEvent
deleteEvent(key: string) {
this.events$.remove(key);
}