Angularjs Pass Multiple Parameters to Pipe

Today, We want to share with you Angularjs Pass Multiple Parameters to Pipe.In this post we will show you angular pass multiple parameters to pipe, hear for how to pass multiple parameters to pipe in angular we will give you demo and example for implement.In this post, we will learn about pass multiple values to pipe angular with an example.

Angularjs Pass Multiple Parameters to Pipe

There are the Following The simple About pass multiple parameters to pipe angular 9 Full Information With Example and source code.

As I will cover this Post with live Working example to develop pass multiple parameters to pipe angular, so the how to pass multiple parameters to pipe in angular 6 is used for this example is following below.

How to Pass Multiple Parameters to Pipe in Angular?

Angular is a platform for building mobile & desktop web Based user friendly and light weight applications.Angular,It’s TypeScript-based open-source Angularjs web application framework.

Solution:


{{ member.desc | descPipe: 'arg1' : 'arg2' : 'arg3'  }}

transform(desc: any, id: any, name: any, blogspot: any): any {
    return desc + ': ' + 'Personal ID is ' + id + '. Personal Name is ' + name + '. Personal Website is ' + blogspot + '.';
}

How to implement Pipes / Filters in Angular 8 with multiple parameters to filter an array?

angularjs pass multiple parameters to pipe

src/app/desc-pipe.pipe.ts

import { Pipe, PipeTransform } from '@angular/core';
    
@Pipe({
  name: 'descPipe'
})
export class DescPipePipe implements PipeTransform {
     
  transform(desc: any, id: any, name: any, blogspot: any): any {
  
    return desc + ': ' + 'Personal ID is ' + id + '. Personal Name is ' + name + '. Personal Website is ' + blogspot + '.';
  
  }
     
}

Import Pipe: src/app/app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
  
import { AppComponent } from './app.component';
import { DescPipePipe } from './desc-pipe.pipe';
  
@NgModule({
  imports:      [ BrowserModule, FormsModule  ],
  declarations: [ AppComponent, DescPipePipe ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

Update Component: src/app/app.component.ts

import { Component } from '@angular/core';
  
@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
})
export class AppComponent  {
  name = 'Angular';
  
  members = [
    {
      id: 1,
      name: 'Hardik Savani',
      gender: 'Male',
      blogspot: 'Pakainfo.com',
      desc: 'Personal Info: ',
    },
    {
      id: 2,
      name: 'Roshani Vala',
      gender: 'Female',
      blogspot: 'infinityknow.com',
      desc: 'Personal Info: ',
    },
    {
      id: 3,
      name: 'Sanajay Sagpariya',
      gender: 'Male',
      blogspot: 'angular.io',
      desc: 'Personal Info: ',
    }
  ]
}

Use Pipe in HTML

src/app/app.component.html

How to Pass Multiple Parameters to Pipe in Angular - Pakainfo.com

ID Member Info Blogspot Desc
{{ member.id }} {{ member.name }} {{ member.blogspot }} {{ member.desc | descPipe: member.id : member.name : member.blogspot }}
Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about angular pipe optional arguments.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment