Title: Feature request: ability to provide all query observable (not only its properties) · Issue #770 · angular/angularfire · GitHub
Open Graph Title: Feature request: ability to provide all query observable (not only its properties) · Issue #770 · angular/angularfire
X Title: Feature request: ability to provide all query observable (not only its properties) · Issue #770 · angular/angularfire
Description: In the current version of Angularfire2 we can provide a query with observable parameters. Database is requested every time one of these parameters have a new value. I think to provide all query object as observable would be a better appr...
Open Graph Description: In the current version of Angularfire2 we can provide a query with observable parameters. Database is requested every time one of these parameters have a new value. I think to provide all query obj...
X Description: In the current version of Angularfire2 we can provide a query with observable parameters. Database is requested every time one of these parameters have a new value. I think to provide all query obj...
Opengraph URL: https://github.com/angular/angularfire/issues/770
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Feature request: ability to provide all query observable (not only its properties)","articleBody":"In the current version of Angularfire2 we can provide a query with observable parameters. Database is requested every time one of these parameters have a new value. I think to provide all query object as observable would be a better approach.\r\n\r\nIn closed issue #603 I mentioned one of typical use cases: loading calendar events for given period (between two dates). Currently I have to code it as follows:\r\n\r\n```\r\nexport class EventsCalendarComponent {\r\n private start$: Subject\u003cstring\u003e = new Subject\u003cstring\u003e();\r\n private end$: Subject\u003cstring\u003e = new Subject\u003cstring\u003e();\r\n\r\n constructor(private db: AngularFireDatabase) {\r\n db.list('/events', {\r\n query: {\r\n orderByChild: 'date',\r\n startAt: this.start$,\r\n endAt: this.end$\r\n }\r\n }).subscribe(events =\u003e {\r\n // update calendar component with events\r\n });\r\n }\r\n\r\n filterByPeriod(start: Moment, end: Moment) {\r\n this.start$.next(start.getTime());\r\n this.end$.next(end.getTime());\r\n }\r\n}\r\n```\r\nCalling the method `filterByPeriod` causes two immediately consecutive requests are fired and the first of them is irrelevant and useless. For such case the ability to have all the query object observable would solve the problem and we code something this:\r\n```\r\nexport class EventsCalendarComponent {\r\n private query$: Subject\u003cObject\u003e = new Subject\u003cObject\u003e();\r\n\r\n constructor(private db: AngularFireDatabase) {\r\n db.list('/events', {\r\n query: this.query$;\r\n }).subscribe(events =\u003e {\r\n // update fullcalendar component with events\r\n });\r\n }\r\n\r\n filterByPeriod(start: Moment, end: Moment) {\r\n this.query$.next({\r\n orderByChild: 'date',\r\n startAt: start.getTime(),\r\n endAt: end.getTime()\r\n });\r\n }\r\n}\r\n```","author":{"url":"https://github.com/tomasklima","@type":"Person","name":"tomasklima"},"datePublished":"2017-01-12T13:10:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/770/angularfire/issues/770"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fe732b3a-57ca-e0e8-4050-1b7bb08ccffd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C1E0:19CD0D:C1069A:102B78B:6A5B6CDE |
| html-safe-nonce | 294ee061f3a097a754f599ce18776b972cf6ea8ff9a0bac760ef36cfa9cf8d92 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMUUwOjE5Q0QwRDpDMTA2OUE6MTAyQjc4Qjo2QTVCNkNERSIsInZpc2l0b3JfaWQiOiIyODEwNTMzNjQwMDE0NjIxOTE4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4448c07e73bc2a9a61c11e6685e965a752483e4f0066a6c9c03c9f6744ce46fe |
| hovercard-subject-tag | issue:200362903 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angularfire/770/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b6c815b36198c269639cbf20067707ba1579856f4d48a5f12aafc43586cb9111/angular/angularfire/issues/770 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b6c815b36198c269639cbf20067707ba1579856f4d48a5f12aafc43586cb9111/angular/angularfire/issues/770 |
| og:image:alt | In the current version of Angularfire2 we can provide a query with observable parameters. Database is requested every time one of these parameters have a new value. I think to provide all query obj... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tomasklima |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angularfire git https://github.com/angular/angularfire.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 49453413 |
| octolytics-dimension-repository_nwo | angular/angularfire |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49453413 |
| octolytics-dimension-repository_network_root_nwo | angular/angularfire |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width