0

I have ag-grid in Angular and CustomFilter. CustomFilter is defined as function in the same file. But this file is large. I want to move CustomFilter to separate file.

This is my code, column definition in Angular in TypeScript:

 "colId": column.FieldName,
 "width": column.Width,
 "filter": CustomFilter,

And definition CustomFilter is in the same file, but outside class in which column definition is placed:

function CustomFilter() {
}

CustomFilter.prototype.setGuiTemplate = function (params) {

}
...

And I want to move CustomFilter to another file and import this file.

1 Answer 1

2

you can create a ts file and export your function like this

    export function CustomFilter(params) {
        // your code here
    }

then import the function in your code (the IDE will suggest you the import)

Sign up to request clarification or add additional context in comments.

1 Comment

export function or export class?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.