javascript - Angular filter "Error: [ngModel:nonassign] Expression '(gridData.StructureViewModel | sumPlanByKpi:kpi)' is non-assignable." -
pls, me resolve error. , wrong?
i have input custom filter | sumplanbykpi:kpi
filtermodule.filter('sumplanbykpi', ['$filter', function ($filter) { return function (input, kpi) { if (angular.isundefined(input) && angular.isundefined(kpi)) return 0; var sum = 0; var findedplansarray = []; (i = 0; < input.length; i++) { var findedplans = $filter('filter')(input[i].plans, function (plan) { return plan.kpi_id === kpi.id; }); var temp = findedplansarray.concat(findedplans); findedplansarray = temp; } angular.foreach(findedplansarray, function (v, k) { if (v.value != null) sum = sum + parseint(v.value); }); return sum; }; }]);
<input type="text" class="form-control input-sm col-lg-1" ng-model="(griddata.structureviewmodel | sumplanbykpi:kpi)" disabled="" pattern="^[0-9]*$" min="0" max="1e+22" step="1" awnum num-sep=',' num-neg=false num-int=40 num-fract=0 num-thousand=true num-thousand-sep="{{' '}}">
i find answer question. should use ng-value input in case instead of ng-model.
<input type="text" class="form-control input-sm col-lg-1" ng-value="(griddata.structureviewmodel | sumplanbykpi:kpi)" disabled="" pattern="^[0-9]*$" min="0" max="1e+22" step="1" awnum num-sep=',' num-neg=false num-int=40 num-fract=0 num-thousand=true num-thousand-sep="{{' '}}">
Comments
Post a Comment