Angular2: No Pipe decorator found on Component

brando

I am using a few pretty standard custom pipes in my Angular 2.0-rc1 app. All was well until I moved the pipes to a new folder. Now I am getting:

zone.js:461 Unhandled Promise rejection: No Pipe decorator found on RoomDetailWidgetComponent ; Zone: angular ; Task: Promise.then ; Value: BaseException {message: "No Pipe decorator found on RoomDetailWidgetComponent", stack: "Error: No Pipe decorator found on RoomDetailWidget…/@angular/compiler/src/runtime_compiler.js:66:49)"}message: "No Pipe decorator found on RoomDetailWidgetComponent"stack: "Error: No Pipe decorator found on RoomDetailWidgetComponent↵ at new BaseException (http://localhost:5000/lib/@angular/compiler/src/facade/exceptions.js:17:23)↵ at PipeResolver.resolve (http://localhost:5000/lib/@angular/compiler/src/pipe_resolver.js:29:15)↵ at CompileMetadataResolver.getPipeMetadata (http://localhost:5000/lib/@angular/compiler/src/metadata_resolver.js:142:47)↵ at eval (http://localhost:5000/lib/@angular/compiler/src/metadata_resolver.js:173:57)↵ at Array.map (native)↵ at CompileMetadataResolver.getViewPipesMetadata (http://localhost:5000/lib/@angular/compiler/src/metadata_resolver.js:173:22)↵ at eval (http://localhost:5000/lib/@angular/compiler/src/runtime_compiler.js:80:58)↵ at Array.forEach (native)↵ at RuntimeCompiler._compileComponent (http://localhost:5000/lib/@angular/compiler/src/runtime_compiler.js:76:36)↵ at eval (http://localhost:5000/lib/@angular/compiler/src/runtime_compiler.js:66:49)"proto: ErrorconsoleError @ zone.js:461_loop_1 @ zone.js:490drainMicroTaskQueue @ zone.js:494ZoneTask.invoke @ zone.js:426 zone.js:463 Error: Uncaught (in promise): No Pipe decorator found on RoomDetailWidgetComponent(…)consoleError @ zone.js:463_loop_1 @ zone.js:490drainMicroTaskQueue @ zone.js:494ZoneTask.invoke @ zone.js:426

import { Component, AfterViewInit, Input, SimpleChange, Output, EventEmitter } from "@angular/core";
import { IPropertyRoom } from "./../../shared/propertyData";
import { FirstHalfPipe } from "./../../shared/pipes/first-half.pipe";
import { SecondHalfPipe } from "./../../shared/pipes/second-half.pipe";

export interface IRoomData {
    roomId: number;
    isFeatured: boolean;
    roomName: string;
    featurePicSrc: string;
    description: string;
    amenities: string[];
}

@Component({
    selector: "room-detail-widget",
    templateUrl: "app/mobile/roomDetailWidget/room-detail-widget.html",
    directives: [],
    pipes: [FirstHalfPipe,SecondHalfPipe]
})
export class RoomDetailWidgetComponent {
    @Input() roomDetail: IRoomData;
    @Output() onRoomTabClick = new EventEmitter();

    constructor() {

    }

    ngOnChanges(changes: { [propName: string]: SimpleChange }) {
        this.roomDetail = changes["roomDetail"].currentValue;

    }
    roomClick() {
        this.onRoomTabClick.emit(this.roomDetail.roomId);

    }

    

}

As you can see, I am declaring the pipes in my component. The paths are all ok. Can't figure out how to fix this.

brando

As it turned out it was a "dumb" error.

I accidentally referenced the offending component as a pipe, rather than a directive, in the parent component as follows:

import { RoomDetailWidgetComponent, IRoomData } from "./../roomDetailWidget/room-detail-widget.component"

@Component({
    directives: [],
    selector: "parent",
    templateUrl: "path/parent.html",
    pipes: [RoomDetailWidgetComponent]  //Duh, big FAIL
})
export class ParentComponent {
 

    constructor() {

    }
    
    
}

Hopefully this will help avert headache for somebody else. Easy mistake to make...

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Angular2: No Pipe decorator found on Component

From Java

The pipe ' ' could not be found angular2 custom pipe

From Dev

Angular2: Injecting a provider into a component using a custom decorator or annotation?

From Dev

Angular2 rc.6 Use pipe in component

From Dev

Angular 2 custom pipe not found

From Dev

Angular2: No component factory found for function HomeComponent

From Dev

How to use a pipe in a component in Angular 2?

From Dev

Angular 2 pipe/filter with component variable

From Dev

Angular 2 pipe/filter with component variable

From Dev

How to consume single Observable property in view from Angular2 component using async pipe?

From Dev

Why can't my Angular2 rc5 component find my shared pipe?

From Dev

Pipe not found in custom component - Ionic 3 (Lazy Loading)

From Dev

Change properties at component decorator Angular 2 from class

From Dev

angular2 - pipe error

From Dev

angular2 final release ng-bootstrap component not found 404

From Dev

Angular2 RC6 pipes. Can I declare a pipe within the same .ts file as my component?

From Dev

The pipe 'async' could not be found - Angular 11

From Dev

The pipe 'async' could not be found - Angular 11

From Dev

Getting 'Could Not Be Found' Error re: Custom Pipe in Angular 2 App

From Dev

How to create and call a pipe from the component in Angular 2?

From Dev

How to add a html with angular-dart component using Decorator

From Dev

How to add a html with angular-dart component using Decorator

From Dev

Angular2: hammerjs is not found

From Dev

angular2 pipe for multiple arguments

From Dev

Angular2: pass in a property name to a pipe

From Dev

Testing Angular2 / TypeScript pipe with Jasmine

From Dev

Angular2 split string (pipe?)

From Dev

Error handling with Angular2 async pipe

From Dev

Angular2 - assign pipe from a variable

Related Related

  1. 1

    Angular2: No Pipe decorator found on Component

  2. 2

    The pipe ' ' could not be found angular2 custom pipe

  3. 3

    Angular2: Injecting a provider into a component using a custom decorator or annotation?

  4. 4

    Angular2 rc.6 Use pipe in component

  5. 5

    Angular 2 custom pipe not found

  6. 6

    Angular2: No component factory found for function HomeComponent

  7. 7

    How to use a pipe in a component in Angular 2?

  8. 8

    Angular 2 pipe/filter with component variable

  9. 9

    Angular 2 pipe/filter with component variable

  10. 10

    How to consume single Observable property in view from Angular2 component using async pipe?

  11. 11

    Why can't my Angular2 rc5 component find my shared pipe?

  12. 12

    Pipe not found in custom component - Ionic 3 (Lazy Loading)

  13. 13

    Change properties at component decorator Angular 2 from class

  14. 14

    angular2 - pipe error

  15. 15

    angular2 final release ng-bootstrap component not found 404

  16. 16

    Angular2 RC6 pipes. Can I declare a pipe within the same .ts file as my component?

  17. 17

    The pipe 'async' could not be found - Angular 11

  18. 18

    The pipe 'async' could not be found - Angular 11

  19. 19

    Getting 'Could Not Be Found' Error re: Custom Pipe in Angular 2 App

  20. 20

    How to create and call a pipe from the component in Angular 2?

  21. 21

    How to add a html with angular-dart component using Decorator

  22. 22

    How to add a html with angular-dart component using Decorator

  23. 23

    Angular2: hammerjs is not found

  24. 24

    angular2 pipe for multiple arguments

  25. 25

    Angular2: pass in a property name to a pipe

  26. 26

    Testing Angular2 / TypeScript pipe with Jasmine

  27. 27

    Angular2 split string (pipe?)

  28. 28

    Error handling with Angular2 async pipe

  29. 29

    Angular2 - assign pipe from a variable

HotTag

Archive