Skip to content

Instantly share code, notes, and snippets.

@ThaneshR
ThaneshR / highlight.pipe.ts
Created July 31, 2018 22:01 — forked from adamrecsko/highlight.pipe.ts
Angular2 text highlight pipe
import {PipeTransform, Pipe} from 'angular2/core';
@Pipe({ name: 'highlight' })
export class HighLightPipe implements PipeTransform {
transform(text: string, [search]): string {
return search ? text.replace(new RegExp(search, 'i'), `<span class="highlight">${search}</span>`) : text;
}
}
/** Usage:
@ThaneshR
ThaneshR / angular-recursive-sample.html
Created July 26, 2018 16:08 — forked from mikeplate/angular-recursive-sample.html
Angular recursive template for tree structure
<!--
interface Organization {
name: string;
url: string;
children: Organization[];
}
org: Organization[];
-->
<div class="invid-tree">
<ng-template #recursiveList let-list>
import {
HttpInterceptor,
HttpRequest,
HttpResponse,
HttpHandler,
HttpEvent
} from '@angular/common/http';
import 'rxjs/add/operator/map';
@Injectable()
window.onload = function () {
if (typeof history.pushState === "function") {
history.pushState("jibberish", null, null);
window.onpopstate = function () {
history.pushState('newjibberish', null, null);
// Handle the back (or forward) buttons here
// Will NOT handle refresh, use onbeforeunload for this.
};
}
else {

HTML5 Markup Template - Basic

A very basic starter template with fundamental HTML5 markup -- only the basics.

Based on HTML5 Bones | http://html5bones.com