タイプテキストの入力を角度を変えて拡張したい場合、ユーザーがテキストを入力した後、テキスト値が入力を入力する際に何らかの浄化を行うカスタムフィルタに渡されます。どのような私が今まで来ているが、私はエラーを取得しています:ここ私自身のサービスを使用して入力を拡大する
angular.js:13920 TypeError: Cannot read property 'length' of undefined
at addDirective (http://bank.com:4000/vendor/bower_components/angular/angular.js:9495:35)
at collectDirectives (http://bank.com:4000/vendor/bower_components/angular/angular.js:8677:11)
at compileNodes (http://bank.com:4000/vendor/bower_components/angular/angular.js:8539:22)
は、私が書いたものです:
angular.module('app').config(extendInputDirective);
function extendInputDirective($provide) {
$provide.decorator('inputDirective', function($delegate, $filter) {
debugger;
var directive = $delegate[0];
var link = directive.link;
directive.compile = function() {
return function(scope,element, attrs, ngModel) {
debugger;
if(attrs.type === 'text') {
ngModel.$parsers.unshift(function(viewValue) {
var value = $filter('pArabicCharFilter')(viewValue);
return value;
});
}
link.apply(this, arguments);
}
}
});
あなたの答えをお寄せいただきありがとうございます。私はこのディレクティブで問題を解決できることを知っていますが、私はこの作業のための別のディレクティブを望んでいません。 – Rachmaninoff
私が追加したプランナーを試してみてください。 – ScottL