angular-cn/packages/core/schematics/migrations/injectable-pipe
crisbeto 6f433887e0 fix(ivy): injectable pipe schematic generating incorrect import statements (#30170)
Currently the injectable pipe schematic generates invalid imports like `import import { Pipe, PipeTransform, Injectable } from '@angular/core'; from '@angular/core';`. The issue wasn't caught by the unit tests, because the invalid import still contains the valid one.

Fixes #30159.

PR Close #30170
2019-04-29 09:39:11 -07:00
..
angular feat(ivy): add injectable-pipe schematic (#29847) 2019-04-23 15:12:19 -07:00
google3 fix(ivy): injectable pipe schematic generating incorrect import statements (#30170) 2019-04-29 09:39:11 -07:00
BUILD.bazel feat(ivy): add injectable-pipe schematic (#29847) 2019-04-23 15:12:19 -07:00
README.md feat(ivy): add injectable-pipe schematic (#29847) 2019-04-23 15:12:19 -07:00
index.ts fix(ivy): injectable pipe schematic generating incorrect import statements (#30170) 2019-04-29 09:39:11 -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 {}