Skip to content

Instantly share code, notes, and snippets.

View alexzuza's full-sized avatar
🎯
Focusing

Alexey Zuev alexzuza

🎯
Focusing
View GitHub Profile
@alexzuza
alexzuza / 0_reuse_code.js
Last active September 22, 2015 10:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/**
 * System configuration for Angular 2 samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
  var packages = {
    app: {
      main: './main.js',
      defaultExtension: 'js'
/**
 * System configuration for Angular 2 samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
  function mapIndex() {
    return {
      'app': 'app',
      '@angular': 'npm:@angular',
<form #myForm="ngForm">
<div>
<label>Firstname:</label>
<input type="text" name="firstName" ngModel>
</div>
<div>
<label>Lastname:</label>
<input type="text" name="lastName" ngModel>
</div>
</form>
<form #myForm="ngForm">
<div>
<label>Firstname:</label>
<input type="text" name="firstName" ngModel>
</div>
<div>
<label>Lastname:</label>
<input type="text" name="lastName" ngModel>
</div>
<fieldset ngModelGroup="address">
import { Component } from '@angular/core';
@Component({
selector: 'address',
template: `
<fieldset ngModelGroup="address">
<div>
<label>Zip:</label>
<input type="text" name="zip" ngModel>
<form #myForm="ngForm">
<div>
<label>Firstname:</label>
<input type="text" name="firstName" ngModel>
</div>
<div>
<label>Lastname:</label>
<input type="text" name="lastName" ngModel>
</div>
<address></address>
@Directive({selector: '[ngModelGroup]', providers: [modelGroupProvider], exportAs: 'ngModelGroup'})
export class NgModelGroup extends AbstractFormGroupDirective implements OnInit, OnDestroy {
@Input('ngModelGroup') name: string;
constructor(
@Host() @SkipSelf() parent: ControlContainer,
@Optional() @Self() @Inject(NG_VALIDATORS) validators: any[],
@Optional() @Self() @Inject(NG_ASYNC_VALIDATORS) asyncValidators: any[]) {
super();
this._parent = parent;
export const formDirectiveProvider: any = {
provide: ControlContainer,
useExisting: forwardRef(() => NgForm)
};
...
@Directive({
selector: 'form:not([ngNoForm]):not([formGroup]),ngForm,[ngForm]',
import { Component } from '@angular/core';
import { ControlContainer, NgForm } from '@angular/forms';
@Component({
selector: 'address',
template: `
<fieldset ngModelGroup="address">
<div>
<label>Zip:</label>