I make a custom directive. now I pass string data from chips-break attribute and convert it an array from link method. it work perfect. but when I getting array length inside ng-keydown method it different. please help me. thanks in advanced :
HTML
<input-chips chips-break="32, 13, 188" style="width:80%"></input-chips>
JS
var app = angular.module("myApp", []);
app.directive("inputChips", inputChipsFun);
function inputChipsFun(){
return{
restrict : 'EA',
scope : {
chipsBreak : "@"
},
template: '<div class="chips"><div class="chips-item"></div><input type="text" ng-keydown="inputKeyDown($event, false)"/></div>',
link : function(scope, elem, attr){
scope.chipsBreak = scope.chipsBreak.split(",");
console.log("Length of Chips Break First Time = "+scope.chipsBreak.length);
scope.inputKeyDown = function($event, is_blur){
console.log("Length of Chips Break Key Press = " + scope.chipsBreak.length);
}
}
};
}
see this link : https://plnkr.co/edit/RpDwaqjS81DZlZFEzdj2?p=preview open inspect element console and type some things and see difference