trotyl / ng-vdom

(Developer Preview) A virtual-DOM extension for Angular, also work as React bridge.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: bridge existing class/function component to Angular

trotyl opened this issue · comments

API Design

import { Migration } from 'ng-renderable'
import { Calendar } from 'some-lib'

@Directive({
  selector: 'my-calendar',
})
class CalendarComponent extends Migration<Calendar> {
  @Input() set date(value: Date) { this.update({ value }) }
  @Output() dateChange = this.observe(props => props.onChange)

  constructor(injector: Injector) {
    super(injector, Calendar)
  }
}

Note: to remain compatible with closure-compiler, string literals cannot be used.