You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 2, 2025. It is now read-only.
Problem : couldn't pass args to the ngPipeInstance
I wanted to create new pipes with custom args in transform() method, but ngPipeInstance doesn't do it.
I think a ngPipeArgs attribute can be a good idea (any[] type).
I tried this, but I'm surprised you didn't do it before, is there a reason ?
DataTableDirective.prototype.applyNgPipeTransform=function(row,columns){// Filter columns with pipe declaredvarcolsWithPipe=columns.filter(function(x){returnx.ngPipeInstance&&!x.ngTemplateRef;});colsWithPipe.forEach(function(el){varpipe=el.ngPipeInstance;varpipeArgs=el.ngPipeArgs ? el.ngPipeArgs : [];//<-- Create the pipeArgs from ngPipeArgs, [] if null// find index of column using `data` attrvari=columns.findIndex(function(e){returne.data===el.data;});// get <td> element which holds data using indexvarrowFromCol=row.childNodes.item(i);// Transform data with PipevarrowVal=$(rowFromCol).text();varrowValAfter=pipe.transform(rowVal, ...pipeArgs);//<-- Add pipeArgs in transform// Apply transformed string to <td>$(rowFromCol).text(rowValAfter);});};
Thank you for your answer,
Adrien.
The text was updated successfully, but these errors were encountered:
I would like to create the PR but I don't really know how to create the spec file 😅. Do you have an example to help me do it ? I saw the DEVELOPER.md guide to run test, but i don't see how to test the new directive in this repo.
🚀 Feature request
Problem : couldn't pass args to the ngPipeInstance
I wanted to create new pipes with custom args in
transform()
method, but ngPipeInstance doesn't do it.I think a
ngPipeArgs
attribute can be a good idea (any[]
type).I tried this, but I'm surprised you didn't do it before, is there a reason ?
Thank you for your answer,
Adrien.
The text was updated successfully, but these errors were encountered: