4

I wrote component that is using a pipe in angular 2. Now I am trying to downgrade the component to be used in my angular 1.5:

angular.module('myApp')
    .directive('Item', downgradeComponent({component: ItemComponent, inputs: ['item'], outputs: ['onTagRemoved'] }) as angular.IDirectiveFactory);

The template of my ItemComponentis using a new pipe. While downgrade I get error message about that pipe.

systemjs.import error: Error: (SystemJS) Can't resolve all parameters for tagPipe: (?).

Do I need to downgrade the pipe to? How? Didn't find anything while search for pipes downgrade.

AngularOne
  • 2,760
  • 6
  • 32
  • 46

2 Answers2

3

You can't downgrade pipes - rewrite it. See this presentation from NG-CONF 2017:

https://www.slideshare.net/jawache/migrating-from-angularjs-when-you-cant-use-the-word-big-bang

https://www.youtube.com/watch?v=4p1jG2QNc4U

developer033
  • 24,267
  • 8
  • 82
  • 108
Julia Passynkova
  • 17,256
  • 6
  • 33
  • 32
0

You can downgrade a pipe like this, if you want to use it programmatically:

angular.module('myApp')
  .factory('myCustomPipe', downgradeInjectable(MyCustomPipe))

Your pipe must be declared in the providers of your angular module:

@NgModule({
  declarations: [
    MyCustomPipe
  ],
  exports: [
    MyCustomPipe
  ],
  providers: [
    MyCustomPipe
  ]
})
export class AppModule {
}