Currently, I am utilizing TypeScript in conjunction with Angular 1.5 and the Angular 1.5 type definition file. However, I am facing a challenge in defining the bindings within an Angular component.
Within the definition file, the bindings are defined as follows:
interface IComponentOptions {
...
bindings?: {[binding: string]: string};
...
}
My concern is how to properly construct the Javascript object:
.component('myComponent', {
templateUrl: 'template.html',
controller: MyController,
controllerAs: 'vm',
bindings: {
one: '<',
two: '<'
}
});
The code provided above results in the following error:
Type '{ one: string; two: string; }' is not assignable to type '{ [binding: string]: string; }'.
I would greatly appreciate any help or suggestions on this matter!