puddlejumper26 / blogs

Personal Tech Blogs
4 stars 1 forks source link

Pipe for displaying '-' when no data received #166

Open puddlejumper26 opened 4 years ago

puddlejumper26 commented 4 years ago

Description

In the real project, when the browser recieves no data from the backend, it displays like 0 or `0.00 or `0.00% etc.

It would be better

Solution - self-made- Pipe

}

Applications normally are in the table

```html
<div>{{ tableDataAttributeA | display-Slash }}</div>

And in the above HTML we could not directly add like percentage format after the pipe, we need to modify

@NgModule({ imports: [ DisplaySlashPipe, ], }) export class SampleModule{ }


- DataStatisticDto
```ts
export interface DataStatisticDto{
     tableDataAttributeA ?: number,
     tableDataAttributeB ?: number,
     tableDataAttributeC ?: number 
}