Skip to content

Instantly share code, notes, and snippets.

@jhades
jhades / 01.ts
Last active January 31, 2018 08:13
Angular Debugging "Expression has changed after it was checked" Error - Simple Explanation (and Fix)
@Component({
selector: 'course',
templateUrl: './course.component.html'
})
export class CourseComponent implements AfterViewInit {
@ViewChild(MatPaginator) paginator: MatPaginator;
ngAfterViewInit() {
import { MatInputModule, MatPaginatorModule, MatProgressSpinnerModule,
MatSortModule, MatTableModule } from "@angular/material";
@NgModule({
declarations: [
...
],
imports: [
BrowserModule,
@jhades
jhades / 01.html
Last active March 23, 2020 01:43
Service Workers: The Complete Guide
<!-- commonly used JS bundles -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" ></script>
<script src="http://getbootstrap.com/dist/js/bootstrap.min.js"></script>
...
<!-- register the Service Worker -->
<script src="sw-register.js"></script>
@jhades
jhades / 01.ts
Last active May 4, 2023 19:02
Angular Security - Authentication with JWT
{
"sub": "353454354354353453",
"exp": 1504699256
}
@jhades
jhades / 01.ts
Last active September 7, 2017 14:50
Angular Authentication
{
"name": "John Doe",
"email": "john@johndoe.com",
"admin": true
}
@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
],
@jhades
jhades / 0.html
Last active September 9, 2020 00:35
Angular Component Styling Guide
<p>A Bootstrap Primary Button:</p>
<button class="btn btn-primary">Button</button>
@jhades
jhades / 01.ts
Last active September 16, 2021 06:10
Content Projection
@Component({
selector: 'app-root',
template: `
<h1>FA Input</h1>
<fa-input icon="envelope" (value)="onNewValue($event)"></fa-input>
<fa-input icon="lock" (value)="onNewValue($event)"></fa-input>
<input placeholder="Type Your Search">