I have the following in a .ts file
module App.Filters {
export class SplitRangeFilter implements ng.IFilterService {
static $inject = ['$filter'];
public static factory(): Function {
return (input: string, splitIndex: number) => {
return input.split('-')[splitIndex];
}
}
}
angular.module("App.Filters", []).filter('SplitRange', () => SplitRangeFilter.factory);
}
and it is giving me a compiler error of:
Class SplitRangeFilter declared interface IFilterService but does not implement it: Types 'SplitRangeFilter' and 'IFilterService' have incompatible signatures. No matching signature for '<T>(name: string) => T'
I cannot find any such signature in angulars documentation. Any suggestions on how to get rid of this compiler error in VS2015
If you just want it to work and aren't concerned about implementing the "right" interface then remove the implements ng.IFilterService
and then change your Angular registration statement to execute the factory (i.e. add ()
)
angular.module("App.Filters", []).filter('SplitRange', () => SplitRangeFilter.factory());