Skip to content

Instantly share code, notes, and snippets.

View molcik's full-sized avatar
👀
WIP

Filip Molcik molcik

👀
WIP
View GitHub Profile
<?php
$html = '<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<p style="font-family: Arial, sans-serif;">ěščřžýáíé</p>
</body>
</html>';
<md-input-container>
<input mdInput placeholder="State" [mdAutocomplete]="auto" [formControl]="stateCtrl">
</md-input-container>
<md-autocomplete #auto="mdAutocomplete" [displayWith]="parseHash.bind(this)">
<md-option *ngFor="let state of filteredStates | async" [value]="state">
{{ state }}
</md-option>
</md-autocomplete>
@Component({
selector: 'auto-complete',
templateUrl: 'auto-complete.template.html',
})
export class AutocompleteExample {
...
parseHash(val: string) {
<ul class="child">
<li *ngFor="let child of children">
{{child.name}}
<my-tree *ngIf="child.children" [children]="child.children"></my-tree>
</li>
</ul>
<my-tree [children]="tree"></my-tree>
@molcik
molcik / hero-detail.component.html
Last active September 20, 2017 08:21
hero-detail.component.html
...
<form [formGroup]="heroForm" (ngSubmit)="onSubmit()" novalidate>
<div style="margin-bottom: 1em">
<button type="submit"
[disabled]="heroForm.pristine || name.invalid" class="btn btn-success">Save</button> &nbsp;
<button type="reset" (click)="revert()"
[disabled]="heroForm.pristine" class="btn btn-danger">Clear</button>
</div>
@molcik
molcik / hero-detail.component.ts
Last active September 20, 2017 08:21
hero-detail.component.ts
...
@Component({
selector: 'hero-detail',
templateUrl: './hero-detail.component.html'
})
export class HeroDetailComponent implements OnChanges {
heroForm: FormGroup;
@molcik
molcik / app.module.ts
Last active September 20, 2017 08:18
app.module.ts
...
@NgModule({
imports: [
BrowserModule,
ReactiveFormsModule // <-- #2 add to @NgModule imports
],
...
})
var array = [1, 1, 1];
var current = 0;
var result;
for (var i=0, len=array.length; i<len;i++) {
current += array[i];
}
result = current;
console.log(result); // logs 3
var array = [1, 1, 1];
var result;
result = array.reduce((current, next) => {
return current + next;
})
console.log(result); // logs 3