Skip to content

Instantly share code, notes, and snippets.

@daslicht
Created November 9, 2016 12:18
Show Gist options
  • Select an option

  • Save daslicht/f4ca6aa5ac4dd28bd2c01ddd6b4b0ba5 to your computer and use it in GitHub Desktop.

Select an option

Save daslicht/f4ca6aa5ac4dd28bd2c01ddd6b4b0ba5 to your computer and use it in GitHub Desktop.
I have the following class which should represent one Collection in Firebase:
```
export class Slideshow {
index: number;
name: string;
slides;
}
```
When I click a list of Slideshows , one slideshow is set as selected slideshow.
I am able to list its slides with something like this:
```
onSelect( slideshow ) {
this.slides = this._af.database.list('/slideshows/'+slideshow.$key+'/slides',{});
...
```
But when I set the type of slideshow to Slideshow like this
```onSelect( slideshow ) {```,
I get:
```Property '$key' does not exist on type 'Slideshow’.any ```
I tried adding it to the Slides class , but that wont work since i never set it manually .
How to deal with that autogenerated ```$key``` property ?
please?
@daslicht
Copy link
Copy Markdown
Author

daslicht commented Nov 9, 2016

I have the following class which should represent one Collection in Firebase:

export class Slideshow {
    index: number;
    name: string;
    slides;  
}

When I click a list of Slideshows , one slideshow is set as selected slideshow.
I am able to list its slides with something like this:

onSelect( slideshow ) {
           this.slides = this._af.database.list('/slideshows/'+slideshow.$key+'/slides',{});
...

But when I set the type of slideshow to Slideshow like this
onSelect( slideshow ) {,
I get:
Property '$key' does not exist on type 'Slideshow’.any

I tried adding it to the Slides class , but that wont work since i never set it manually .
How to deal with that autogenerated $key property ?
please?

@daslicht
Copy link
Copy Markdown
Author

daslicht commented Nov 9, 2016

export class Slideshow {
    $key?:string;
    index: number;
    name: string;
    slides;  
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment