{"ast":null,"code":"import { map } from 'rxjs';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"../image-service/image.service\";\n\nfunction ImageListComponent_li_6_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"li\", 4);\n i0.ɵɵtext(1);\n i0.ɵɵelement(2, \"br\");\n i0.ɵɵtext(3);\n i0.ɵɵelement(4, \"br\")(5, \"img\", 5);\n i0.ɵɵelementEnd();\n }\n\n if (rf & 2) {\n const tutorial_r1 = ctx.$implicit;\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", tutorial_r1.userId, \" \");\n i0.ɵɵadvance(2);\n i0.ɵɵtextInterpolate1(\" \", tutorial_r1.articleId, \" \");\n i0.ɵɵadvance(2);\n i0.ɵɵpropertyInterpolate1(\"src\", \" \", tutorial_r1.imageUrl, \"\", i0.ɵɵsanitizeUrl);\n }\n}\n\nexport let ImageListComponent = /*#__PURE__*/(() => {\n class ImageListComponent {\n constructor(service) {\n this.service = service;\n this.articleByUser = [];\n }\n\n ngOnInit() {\n // this.service.imageList?.snapshotChanges().subscribe(\n // list => {\n // this.imageList = list.map(item => {\n // return item.payload.val();\n // })\n // this.rowIndex = Array.from(Array(Math.ceil(this.imageList.length / 3)).keys());\n // console.log(\"images\", this.imageList[0]);\n // console.log(\"indexes\", this.rowIndex);\n // }\n // );\n this.getAll();\n console.log(this.imageList);\n }\n\n getAll() {\n this.service.getAll().snapshotChanges().pipe(map(changes => changes.map(c => Object.assign({\n key: c.payload.key\n }, c.payload.val())))).subscribe(data => {\n // @ts-ignore\n this.imageList = data;\n });\n }\n\n getforuser(userId) {\n // @ts-ignore\n let response;\n\n for (let i of this.imageList) {\n if (i.userId === userId) {\n this.articleByUser.push(i);\n }\n }\n }\n\n }\n\n ImageListComponent.ɵfac = function ImageListComponent_Factory(t) {\n return new (t || ImageListComponent)(i0.ɵɵdirectiveInject(i1.ImageService));\n };\n\n ImageListComponent.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n type: ImageListComponent,\n selectors: [[\"app-image-list\"]],\n decls: 7,\n vars: 1,\n consts: [[1, \"image-list\"], [1, \"btn\", \"btn-success\", \"float-right\", 3, \"click\"], [1, \"list-group\"], [\"class\", \"list-group-item\", 4, \"ngFor\", \"ngForOf\"], [1, \"list-group-item\"], [\"alt\", \"\", 3, \"src\"]],\n template: function ImageListComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"p\");\n i0.ɵɵtext(1, \"image-list works!\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(2, \"div\", 0)(3, \"button\", 1);\n i0.ɵɵlistener(\"click\", function ImageListComponent_Template_button_click_3_listener() {\n return ctx.getforuser(10);\n });\n i0.ɵɵtext(4, \"Get all from db\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(5, \"ul\", 2);\n i0.ɵɵtemplate(6, ImageListComponent_li_6_Template, 6, 3, \"li\", 3);\n i0.ɵɵelementEnd()();\n }\n\n if (rf & 2) {\n i0.ɵɵadvance(6);\n i0.ɵɵproperty(\"ngForOf\", ctx.articleByUser);\n }\n },\n styles: [\"\"]\n });\n return ImageListComponent;\n})();","map":null,"metadata":{},"sourceType":"module"}