npm.io
1.0.15 • Published 7 years ago

nger-dom

Licence
ISC
Version
1.0.15
Deps
4
Size
28 kB
Vulns
0
Weekly
0
Stars
54

nger-rx-dom

基于rx的dom系统

component->subject->attribute

  • [] 组件input变更,通知dom属性或内容变更
  • [] 属性或内容变更,通知component变更

text node

@Component({
    selector: `nger-demo`,
    // (that: NgerDemoComponent)=>h(that.title)
    template: `{{title}}`
})
export class NgerDemoComponent{
    static template = ()=>h();
    title: string;
    constructor(public elementRef: ElementRef){}
}

divNode

@Component({
    selector: `nger-demo`,
    template: `{{title}}`
})
export class NgerDemoComponent{
    title: Subject = new Subject();
    constructor(public elementRef: ElementRef){
        this.title.subscribe(res=>{
            this.elementRef.nativeElement.text = res;
        })
    }
}