angular-cn/packages/core/schematics/migrations/injectable-pipe
Paul Gschwendtner f69e4e6f77 refactor(core): move google3 migration rules into single directory (#30956)
Moves all google3 migration tslint rules into a single directory.
This makes it easier to wire up multiple migration rules in
google3 without having to update the rule directories each time
a new migration is available.

PR Close #30956
2019-07-23 15:52:40 -07:00
..
angular feat(ivy): add injectable-pipe schematic (#29847) 2019-04-23 15:12:19 -07:00
BUILD.bazel refactor(core): move google3 migration rules into single directory (#30956) 2019-07-23 15:52:40 -07:00
README.md feat(ivy): add injectable-pipe schematic (#29847) 2019-04-23 15:12:19 -07:00
index.ts fix(core): TypeScript related migrations should cater for BOM (#30719) 2019-05-30 20:48:45 -07:00
util.ts fix(ivy): injectable pipe schematic generating incorrect import statements (#30170) 2019-04-29 09:39:11 -07:00

README.md

Injectable annotation on pipes

In ViewEngine it was possible to inject a class that was annotated as a Pipe, however this no longer works in Ivy if the class also doesn't have the Injectable decorator. This migration adds Injectable automatically to all Pipe classes.

Before

import { Pipe } from '@angular/core';

@Pipe({ name: 'myPipe' })
class MyPipe {}

After

import { Pipe, Injectable } from '@angular/core';

@Injectable()
@Pipe({ name: 'myPipe' })
class MyPipe {}