0

In Angular 1.x, I was able to inject $filter and do something like this in my JavaScript/TypeScript code:

formattedDate = $filter('date')(new Date(), "yyyy-MM-dd");

Is there an equivalent in Angular 2?

kshetline
  • 12,547
  • 4
  • 37
  • 73
  • 1
    Are you looking for [pipes](https://angular.io/docs/ts/latest/guide/pipes.html)? They're the first hit for *"Angular2 equivalent of filter"*. – jonrsharpe Jan 21 '17 at 14:39
  • I found info on pipes, but only on creating my own, not how I'd access the ones built into Angular 2, except for accessing them from within HTML. – kshetline Jan 21 '17 at 14:43
  • They work with regular A2 DI, or you can just `new` some of them up. – jonrsharpe Jan 21 '17 at 14:44
  • ^^ pretty much word-for-word dupe. Please do research things before asking. – jonrsharpe Jan 21 '17 at 14:46
  • I did a fair amount of searching, I didn't just blurt out the question. I obviously didn't stumble on the right wording for my search, however. – kshetline Jan 21 '17 at 14:49

0 Answers0