Skip to content

can it support module.component({'myInput': myInput}) ? #31

@onlymisaky

Description

@onlymisaky

register a component like this:

// my-input.component.ts
import { IComponentOptions, IController, INgModelController } from 'angular';

export const myInput: IComponentOptions = {
  template: require('./my-input.component.html'),
  require: {
    ngModelCtrl: '^ngModel'
  },
  controller: class implements IController {


    ngModelCtrl: INgModelController;


    get val(): string {
      return this.ngModelCtrl.$modelValue;
    }

    set val(val: string) {
      this.ngModelCtrl.$setViewValue(val);
    }

  }
}
// common.module.ts
import * as angular from 'angular';

import { myInput } from 'components/my-input/my-input.component';
import { myButton } from 'components/my-input/my-button.component';

angular
  .module('app.common')
  .component({ myInput, myButton})

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions