Skip to content

Instantly share code, notes, and snippets.

View emolr's full-sized avatar

Emil Møller emolr

  • Hi, freelance designer/programmer
  • Denmark
View GitHub Profile
// app-form-base.class.ts
import {Subject, Observable} from "rxjs";
export class AppFormsBase {
public isSending$: Observable<any>;
public isSendingSubject = new Subject<any>();
public succeeded$: Observable<any>;
public succeededSubject = new Subject<any>();
public failed$: Observable<any>;
// article-form.backend.ts
import {Injectable} from "@angular/core";
import {IArticle} from "./article-form.interface";
@Injectable()
export class ArticleFormBackend {
constructor(
// Pass your client here (http, apollo etc..)
) {}
// article-form.interface.ts
export interface IArticleForm {
id?: string,
authorId?: string,
title?: string,
description?: string,
content?: string,
published?: boolean
}
// article-form.model.ts
import {FormGroup, FormControl, Validators} from "@angular/forms";
import {IArticle} from "./article-form.interface";
export class ArticleModel {
public id: string;
public authorId: string;
public title: string;
public description: string;
@emolr
emolr / medium-ui-forms - article-form.model.ts
Last active February 23, 2017 16:49
Article Model for angular 2, as part of a article written on medium
// article-form.model.ts
import {FormGroup, FormControl, Validators} from "@angular/forms";
import {IArticle} from "./article-form.interface";
export class ArticleModel {
public id: string;
public authorId: string;
public title: string;
public description: string;
import { Kettle, Cup, Tea, Honey } from '@kitchen/cupboard';
import { TapWater } from '@kitchen/sink';
import { Consume, Smile, Feel } from '@life/actions';
//...
@Input private flavor: String = “Japanese mountain tea”;
ngOnInit() {
@emolr
emolr / .gitignore
Last active September 2, 2015 05:45
Just clone me and run `npm install && ./node_modules/.bin/bower install`. Example at http://misc.ankr.dk/lunrjs/
bower_components/*
node_modules/*
/*
* angular-ui-bootstrap
* http://angular-ui.github.io/bootstrap/
* Version: 0.13.0 - 2015-05-02
* License: MIT
*/
angular.module("ui.bootstrap", ["ui.bootstrap.tpls","ui.bootstrap.dropdown","ui.bootstrap.position"]);
angular.module("ui.bootstrap.tpls", []);
angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
/*
* Contenteditable placeholder
* -----------------------------------
* Emulates the behavior of the standerd implementation
* of the input placeholder="text", but can be used on any
* html element that supports focus.
* http://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus
*/
[contenteditable="true"]:before {
// Core
//
// Core modules are modules which is already integrated in tavarn
// and can be used with no sweat in the app
//
// Styleguide 1.0.0
// Logger
//