Skip to content

Commit 7ac4d03

Browse files
authored
Merge pull request #475 from SwabianCoder/feature/467-ngx-toolset-template-type-checker-should-make-use-of-standalone-api
Feature/467 ngx toolset template type checker should make use of standalone api
2 parents 1f15401 + 931c627 commit 7ac4d03

File tree

6 files changed

+30
-33
lines changed

6 files changed

+30
-33
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+
## [2.0.0] - 2023-11-10
9+
10+
### Added
11+
12+
- support for Angular's standalone API
13+
814
## [1.0.1] - 2023-08-26
915

1016
### Fixed

projects/template-type-checker/README.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,35 @@ Choose the version corresponding to your Angular version:
3030

3131
| Angular | @ngx-toolset/template-type-checker |
3232
|---------|------------------------------------|
33-
| 16.x.x | 1.x.x |
33+
| 14.x.x | >=0.0.1 <=1.0.0-rc.9 |
34+
| 15.x.x | 1.0.0-rc.10 |
35+
| 16.x.x | >=1.0.0-rc.11 <=2.x.x |
3436

3537
## Usage
3638

37-
### Module Import
39+
### Import
3840

39-
Import the `TemplateTypeCheckerModule` in the module(s) you would like to use the `TypeCheckerPipe`:
41+
Import the `TypeCheckerPipe` in the component(s) you would like to use it:
4042

4143
```ts
42-
import { NgModule } from '@angular/core';
43-
import { SampleComponent } from './sample.component';
44-
import { TemplateTypeCheckerModule } from '@ngx-toolset/template-type-checker';
45-
46-
@NgModule({
47-
declarations: [SampleComponent],
48-
imports: [
49-
TemplateTypeCheckerModule,
50-
],
44+
import { Component } from '@angular/core';
45+
import { TypeCheckerPipe } from '@ngx-toolset/template-type-checker';
46+
47+
@Component({
48+
selector: 'app-sample',
49+
templateUrl: 'sample.component.html',
50+
styleUrls: ['sample.component.scss'],
51+
standalone: true,
52+
imports: [TypeCheckerPipe],
5153
})
52-
export class SampleModule {}
54+
export class SampleComponent {}
5355
```
5456

55-
### TS
57+
### TS Example
5658

5759
```ts
5860
import { Component } from '@angular/core';
61+
import { TypeCheckerPipe } from '@ngx-toolset/template-type-checker';
5962

6063
class ClassA {}
6164

@@ -64,7 +67,9 @@ class ClassB {}
6467
@Component({
6568
selector: 'app-sample',
6669
templateUrl: './sample.component.html',
67-
styleUrls: ['./sample.component.scss']
70+
styleUrls: ['./sample.component.scss'],
71+
standalone: true,
72+
imports: [TypeCheckerPipe],
6873
})
6974
export class SampleComponent {
7075
public classA: typeof ClassA;
@@ -79,7 +84,7 @@ export class SampleComponent {
7984
}
8085
```
8186

82-
### HTML
87+
### HTML Example
8388

8489
```html
8590
<!-- TypeCheckerPipe returns object of type ClassA -> ngIf evaluates to truthy value -->

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.1",
3+
"version": "2.0.0",
44
"description": "Validate object's class instance type in Angular HTML template",
55
"homepage": "https://github.com/SwabianCoder/ngx-toolset",
66
"license": "MIT",

projects/template-type-checker/src/lib/template-type-checker.module.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

projects/template-type-checker/src/lib/type-checker.pipe.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Pipe, PipeTransform } from '@angular/core';
2+
23
import { Constructor } from './types';
34

45
/**
@@ -11,6 +12,7 @@ import { Constructor } from './types';
1112
*/
1213
@Pipe({
1314
name: 'typeChecker',
15+
standalone: true,
1416
})
1517
export class TypeCheckerPipe implements PipeTransform {
1618
/**
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export * from './lib/template-type-checker.module';
21
export * from './lib/type-checker.pipe';

0 commit comments

Comments
 (0)