Questions tagged [angular2-pipe]

An Angular 2 pipe takes in data as input and transforms it to a desired output.

An Angular 2 pipe takes in data as input and transforms it to a desired output.

The first version of AngularJS, used the concept of filters to format the value of an expression for display to the user.

Angular 2 introduced a similar concept, now called pipe.

187 questions
2
votes
1 answer

How to display and filter deep-nested JSON with angular

I have the following JSON object: http://pastebin.com/1TguvZXc I am trying to access the following property for every model, year, and style: Model.Model[].Years[].Styles[].submodel.modelName My attempt:
Moshe
  • 2,583
  • 4
  • 27
  • 70
2
votes
2 answers

Custom Pipe | filter for calculating relative time in angular2

During the learning process, I came across Creation of Custom Pipe, so I thought this will help.
Aravind
  • 40,391
  • 16
  • 91
  • 110
2
votes
2 answers

Angular filter table using custom pipe upon button click

I have a table which I successfully filter using a custom pipe. The filter is based on two inputs which are together a form. The functionality I want to add is for the filtering not to happen until a submit button is clicked. So it's more like a…
Drew13
  • 1,301
  • 5
  • 28
  • 50
2
votes
1 answer

Angular2: Error while using a text filter pipe to filter an array

I want to be able to search though the categories array by performing a search on the category name. I tried the following solution, but I'm not sure how to edit the variables in the pipe to fit my need. With the following code, console logs the…
anonym
  • 4,460
  • 12
  • 45
  • 75
2
votes
0 answers

Angular 2 DatePipe shortTime display is off by 6 hours

I have a datetime returning as "2016-12-20T19:00:00" and am using a the following pipe on it: {{ dateObj | date:'shortTime' }} I want/expect that to display as 7:00 PM, but it instead is displaying as 1:00 PM. Is this a bug with Angular, or am I…
Bryan
  • 2,951
  • 11
  • 59
  • 101
2
votes
1 answer

Using i18n select pipe

I'm trying to use I18nSelectPipe. I have the following code: this.criteria = []; this.criteria.push({ id: 1, name: 'ab' }); this.criteria.push({ id: 2, name: 'cd' }); this.criteria.push({ id: 3, name: 'ef' }); this.criteriaChoice =…
dev_054
  • 3,448
  • 8
  • 29
  • 56
2
votes
1 answer

Pipe update for each control change in reactive form

I'm having troubles using a pipe in my reactive form. I have a pipe that transforms my object into an array so it can be used with *ngFor. So far so good... the problem is that when I create an input (using form control to bind the value) inside my…
Nate
  • 7,606
  • 23
  • 72
  • 124
2
votes
1 answer

Can I return built-in pipe?

I have a question about angular2 pipe. I want to get pipes as return value depending on schema:string. I think 2 way to get it, but both are not working. page.html

{{value | getSchema(value, schema)}}

page.ts getSchema(value, schema){ …
Daisy
  • 89
  • 2
  • 9
2
votes
1 answer

Unable to register custom pipe globally in Angular 2

I have a custom pipe which does some 'stuff' @Pipe({name: 'doSomethingAwesome'}) export class DoSomethingAwesomePipe: implements PipeTransform {...} I then have two modules Module1, Module2, for each module the declarations array looks like…
Steven Yates
  • 2,400
  • 3
  • 30
  • 58
2
votes
2 answers

Angular 2 Usage of Http Observable and Pipe

I have a service that call a REST endpoint: import { Task } from './task'; import { TaskStatus } from './task-status'; import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; @Injectable() export class TaskService { …
Evgeni Dimitrov
  • 21,976
  • 33
  • 120
  • 145
2
votes
0 answers

How to add a mask 'yyyy/yyyy' in angular2, using pipe and formatter to input field

I'd like to know how can I create a mask with regex expression for input field. I need to add some masks to a field, such as: yyyy/yyyy. This sounds like a period. I saw a link that creates a mask using the pipe from Angular2. Here is the link. So,…
Celso Agra
  • 1,389
  • 2
  • 15
  • 37
2
votes
1 answer

Why is this Angular 2 Pipe not returning data?

I am building an Angular 2 pipe using Angular 2.0.0-RC.4. It should filter all Foo objects passed in as an array of Foo based on property bar. When I step through the code in the debugger, the 'allFoo' var is populated, as is the 'bar' var. I can…
slasky
  • 2,726
  • 4
  • 27
  • 36
2
votes
1 answer

Angular 2 - Piping value and returning DOM element

I am attempting to use a custom pipe to take in a int value and then return a material design icon based on that int. HTML: {{item.MetGoal | NumberToStatusSymbol}} TypeScript/JS: transform(value, args?) { switch (value){ case '0': …
Tekk_Know
  • 161
  • 2
  • 12
2
votes
0 answers

No Pipe decorator found on SearchPipe angular2 RC4

I am trying to use a custom Pipe declaration to search and filter elements in a list. But I get the following error and can not figure out why.(I am using angular2-seed project as the base project) Error: platform-browser.umd.js:1900 EXCEPTION:…
chamalabey
  • 457
  • 5
  • 12
2
votes
1 answer

Angular2 Pipe filter by name best approach

Just wondering what is the best approach for using PIPE in Angular2 in my situation, although my solution has worked well. Let's start it. I have this json array https://jsonplaceholder.typicode.com/users My PIPE transform(value: any, name: any):…
Tiago Matos
  • 1,586
  • 1
  • 20
  • 29