Skip to content

Pipe argument not working #226

Description

@deepakgd

Hi,
I have created custom pipes for filtering data. Normal pipe and custom pipe working fine. But the issue is pipe argument not working.

My custom pipe code is:

import {Pipe} from 'angular2/core';
@Pipe({
  name: 'toggl'
})
export class ToggleArgs {
  transform(value,[status]) {
    return value.filter((item)=>item.status === status);
  }
}

My component code is

import {Component} from 'angular2/core';
import {ToggleArgs} from '../../pipes/toggle-args/toggle-args';

@Component({
  selector: 'test-component',
  templateUrl: 'app/components/test-component/test-component.html',
  styleUrls: ['app/components/test-component/test-component.css'],
  providers: [],
  directives: [],
  pipes: [ToggleArgs]
})
export class TestComponent {
list;
 constructor() {
    this.list = [{"title": "eat", "status": "WIP"},{"title": "code", "status": "WIP"},{"title": "sleep", "status": "WIP"}]
  }
}

html code:
<li *ngFor="#item of list | toggl:'completed'">{{item.title}} and {{item.status}}</li>
Output:
Build error

[DiffingTSCompiler]: Typescript found the following errors:
app/pipes/toggle-args/toggle-args.spec.ts (22, 14): Supplied parameters do not match any signature of call target.

Same code I have tried as per the quickstart guide (https://angular.io/docs/ts/latest/quickstart.html) it was working fine. Please solve this issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions