0
I’m creating a filter for the angular using the compiler Gulp however I am having an error and when analyzing the compiled code it seems that is compiling something wrong, what could be?
Filter:
class StrSplit extends Filter
contructor: ->
return (str, splitChar, splitIndex)->
return '' unless str
str.split(splitChar)[splitIndex]
View:
{{mystr | strSplit:',':0}}
Compiled filter:
StrSplit = (function() {
function StrSplit() {}
StrSplit.prototype.contructor = function() {
return function(str, splitChar, splitIndex) {
if (!str) {
return '';
}
return str.split(splitChar)[splitIndex];
};
};
return StrSplit;
})();
angular.module('ng-utils').filter('strSplit', [StrSplit]);
Error found:
Can’t Interpolate: 2 - {{text_filter | strSplit:',':0}} Typeerror: Cannot read Property 'apply' of Undefined
Thank you very much.
– Daniel