Skip to content

Instantly share code, notes, and snippets.

@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>
import { MatInputModule, MatPaginatorModule, MatProgressSpinnerModule,
MatSortModule, MatTableModule } from "@angular/material";
@NgModule({
declarations: [
...
],
imports: [
BrowserModule,
@Component({
selector: 'login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent {
form = this.fb.group({
email: ["", {
@jhades
jhades / 01-home.ts
Last active May 12, 2022 12:09
Angular 2 Smart Components vs Presentation Components: What's the Difference, When to Use Each and Why?
@Component({
selector: 'app-home',
template: `
<h2>All Lessons</h2>
<h4>Total Lessons: {{lessons?.length}}</h4>
<div class="lessons-list-container v-h-center-block-parent">
<table class="table lessons-list card card-strong">
<tbody>
<tr *ngFor="let lesson of lessons" (click)="selectLesson(lesson)">
@jhades
jhades / 01.json
Last active April 7, 2022 16:54
Angular vs jQuery
{
"-KgVwEC-dwWkLO4ZsQ9e": {
"description": "Angular Tutorial For Beginners - Build Your First App - Hello World Step By Step",
"longDescription": "This is step by step guide to create your first Angular application. Its aimed at beginners just starting out with the framework.This lesson will show how to create a component, and how to link the component to a given custom HTML tag. It will show how to give the component a given template.",
"tags": "BEGINNER",
"url": "angular-hello-world-write-first-application",
"videoUrl": "https://www.youtube.com/embed/du6sKwEFrhQ"
},
"-KgVwEC0vq_chg0dvlrb": {
"courseId": "-KgVwEBq5wbFnjj7O8Fp",
@jhades
jhades / 01-object-example.js
Last active March 21, 2022 04:11
Javascript for Java Developers
// create an empty object - no class was needed !!
var superhero = {};
superhero.name = 'Superman';
superhero.strength = 100;
@jhades
jhades / 01.html
Last active February 25, 2022 14:49
Angular Custom Form Controls: Complete Guide - https://blog.angular-university.io/angular-custom-form-controls
<div [formGroup]="form">
<input placeholder="Course title" formControlName="title">
<input type="checkbox" placeholder="Free course" formControlName="free">
<textarea placeholder="Description" formControlName="longDescription">
</textarea>
@jhades
jhades / 01.ts
Last active February 24, 2022 16:37
Angular Responsive Design: Complete Guide
export declare const Breakpoints: {
XSmall: string;
Small: string;
Medium: string;
Large: string;
XLarge: string;
Handset: string;
Tablet: string;
Web: string;
HandsetPortrait: string;
@jhades
jhades / 01.html
Last active February 10, 2022 10:13
Angular Material Datepicker
<mat-form-field appearance="outline">
<input matInput formControlName="releasedAt">
</mat-form-field>
@jhades
jhades / 01.ts
Last active January 11, 2022 10:31
Introduction to Ngrx Store
export interface Thread {
id:number;
messageIds: number[];
participants: {[key:number]: number};
}
export interface Message {
id:number;