POV
POV

Reputation: 12005

Pipe or Service in Angular?

I need to provide simple array of data with years. What will be right to create: pipe or typically service class?

Iameging, that it is pipe. Then can I iterate this pipe in ngFor like this:

ngFor="item of pipe()"?

Upvotes: 0

Views: 51

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222532

You should create an array in this case, neither pipe nor a service.

You can create an array by calling a function with the name pipe() though, that would return an array with your specified data.

Upvotes: 2

Related Questions