How to apply filters to *ngFor?

Basically, you write a pipe which you can then use in the *ngFor directive. In your component: In your template, you can pass string, number or object to your pipe to use to filter on: In your pipe: Remember to register your pipe in app.module.ts; you no longer need to register the pipes in your @Component Here’s a Plunker which … Read more

Angular 2 multiple modules

Two things need to be done here: First, export TopNavigation & Search components from the CommonModule so they can be used in other modules: Secondly, the CommonModule should be imported by the Module that actually uses it. In your case the SpreadSheet module should import CommonModule Modules do not inherit components are declared in other modules. So when you import CommonModule in AppModule it does not have any … Read more

Check if Variable is Empty – Angular 2

Lets say we have a variable called x, as below: following statement is valid, 1. Number: and for x = undefined or x = 0 (be careful here) 2. String x = null , x = undefined or x = “” 3 Boolean x = false and x = undefined, By keeping above in mind we can easily check, whether variable is empty, null, 0 or undefined … Read more