Skip to content

Instantly share code, notes, and snippets.

import { MatInputModule, MatPaginatorModule, MatProgressSpinnerModule,
MatSortModule, MatTableModule } from "@angular/material";
@NgModule({
declarations: [
...
],
imports: [
BrowserModule,
@jhades
jhades / 01.ts
Last active July 22, 2022 13:48
ng-template, ng-container and ngTemplateOutlet examples
@Component({
selector: 'app-root',
template: `
<ng-template>
<button class="tab-button"
(click)="login()">{{loginText}}</button>
<button class="tab-button"
(click)="signUp()">{{signUpText}}</button>
</ng-template>
@jhades
jhades / 01.ts
Last active January 21, 2020 10:45
Angular HTTP
import {HttpClientModule} from '@angular/common/http';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
HttpClientModule
],
import {FirebaseApp} from "angularfire2";
@Injectable()
export class LessonsService {
constructor( @Inject(FirebaseApp) fb) {
const rootDbRef = fb.database().ref();
rootDebRef.on('value', snapshot => console.log(snapshot.val()));
@jhades
jhades / 01.html
Last active December 18, 2020 10:12
Introduction to Angular Forms - Template Driven and Reactive Forms - https://blog.angular-university.io/introduction-to-angular-2-forms-template-driven-vs-model-driven/
<section class="sample-app-content">
<h1>Template-driven Form Example (with bi-directional data binding):</h1>
<form #myForm="ngForm" (ngSubmit)="onSubmitTemplateBased()">
<p>
<label>First Name:</label>
<input type="text"
[(ngModel)]="user.firstName" required>
</p>
<p>
<label>Password:</label>
@kyungw00k
kyungw00k / package.json
Last active September 19, 2016 21:40
Firebase Queue Example
{
"name": "my-queue",
"version": "1.0.0",
"description": "My Queue",
"main": "queue_worker.js",
"dependencies": {
"firebase": "2.x",
"firebase-queue": "^1.0.0"
}
}
@dmethvin
dmethvin / gist:1676346
Created January 25, 2012 13:51
Breakpoint on access to a property
function debugAccess(obj, prop, debugGet){
var origValue = obj[prop];
Object.defineProperty(obj, prop, {
get: function () {
if ( debugGet )
debugger;
return origValue;
},