Skip to content

Commit eeb9d25

Browse files
committed
📝 Improved sample usage of template-type-checker project
1 parent c1ac26a commit eeb9d25

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

projects/template-type-checker/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.0.0-rc.2] - 2022-08-15
9+
10+
### Changed
11+
12+
- Sample usage
13+
814
## [1.0.0-rc.1] - 2022-08-14
915

1016
### Added

projects/template-type-checker/README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
- [NPM](#npm)
1414
- [Usage](#usage)
1515
- [Module Import](#module-import)
16-
- [HTML](#html)
1716
- [TS](#ts)
17+
- [HTML](#html)
1818

1919
## Features
2020

@@ -46,32 +46,43 @@ import { TemplateTypeCheckerModule } from '@ngx-toolset/template-type-checker';
4646
export class SampleModule {}
4747
```
4848

49-
### HTML
50-
51-
```angular2html
52-
<div *ngIf="sampleObject | typeChecker:classA">
53-
</div>
54-
```
55-
5649
### TS
5750

5851
```ts
5952
import { Component } from '@angular/core';
6053

6154
class ClassA {}
6255

56+
class ClassB {}
57+
6358
@Component({
6459
selector: 'app-sample',
6560
templateUrl: './sample.component.html',
6661
styleUrls: ['./sample.component.scss']
6762
})
6863
export class ProductAlertsComponent {
6964
public classA: typeof ClassA;
65+
public classB: typeof ClassB;
7066
public sampleObject: ClassA;
7167

7268
public constructor() {
7369
this.classA = ClassA;
70+
this.classB = ClassB;
7471
this.sampleObject = new ClassA();
7572
}
7673
}
74+
```
75+
76+
### HTML
77+
78+
```html
79+
<!-- TypeCheckerPipe returns object of type ClassA -> ngIf evaluates to truthy value -->
80+
<div *ngIf="sampleObject | typeChecker:classA">
81+
This div will be rendered.
82+
</div>
83+
84+
<!-- TypeCheckerPipe returns undefined -> ngIf evaluates to falsy value -->
85+
<div *ngIf="sampleObject | typeChecker:classB">
86+
This div will not be rendered.
87+
</div>
7788
```

projects/template-type-checker/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ngx-toolset/template-type-checker",
3-
"version": "1.0.0-rc.1",
3+
"version": "1.0.0-rc.2",
44
"description": "Angular template class type check support",
55
"homepage": "https://github.com/SwabianCoder/ngx-toolset",
66
"license": "MIT",

0 commit comments

Comments
 (0)