lega911 / angular-light

Alight is a library for building interactive MVVM web interfaces/applications. (project is deprecated)
MIT License
274 stars 43 forks source link

simple api #187

Closed lega911 closed 7 years ago

lega911 commented 8 years ago

Binding

alight('#app', {
    data: 'info',
    click: () => {}
})

var cd = alight('#app', function(scope) {
    this.watch('name')

    this.click = () => {
        this.scan()
    })  
});
cd.scan();

Directives / Controller

alight.directives.al.test = function(scope, element, value, env) {
  this.watch()
  this.scan()
}
<div main-ctrl()></div>
function mainCtrl(scope, element, value, env) {
  this.watch();
}

// scope.mainCtrl = function(scope, element) {};

Component

//alight.createComponent -> alight.component

alight.component.book = function(scope, element, env) {
  this.watch();
  this.scan();
  return {
    template: '',
    onStart: function() {}
  }
};

alight.component.book = {
  template: '',
  onStart: function(scope, element) {
    this.watch()
    this.scan()
  }
};

alight.d.$global.book = {
  component: function(scope, element, env) {
    return {
      template: '',
      onStart: function() {}
    }
  }
};

Filters

<div>{{when | date yyyy-mm-dd }}</div>
webmalex commented 8 years ago

+1