This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is a simple AngularJs(>2.x) module for initializing the firebase app and async pipes for fetching data from firebase | |
database. | |
For fetching all details from particular location. | |
Syntax: | |
{{'clients/-KiAAhNT6LZMHGS9c-4g/name' | firePipeValue:'on' | async}} | |
{{'clients/-Ki9saJqb03SACfx89_X' | firePipeValue:'off' | async}} | |
Note: Dont use the above pipe for fetching list of objects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Typescript version | |
class Pagination { | |
public dataRef: string; | |
public perPage: number; | |
public order: string; | |
public hasRecords: boolean = true; | |
private _pageRecordCount: number = 0; | |
private _cursor: string = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Javascript version | |
var Pagination = (function () { | |
function Pagination(dataRef, perPage, order) { | |
this.hasRecords = true; | |
this._pageRecordCount = 0; | |
this._cursor = ""; | |
this.dataRef = dataRef; | |
this.perPage = perPage || 10; | |
this.order = order || 'dsc'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, Input, Output, EventEmitter, AfterViewInit } from "@angular/core"; | |
import { Pagination } from "./pagination"; | |
@Component({ | |
selector: "fb-pagination", | |
template:` | |
<button [disabled]="!hasRecords" (click)="fetchMore()" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored"> | |
More | |
</button> | |
` |