-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
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})