Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8e2441a

Browse files
committed
feat(template): migrate RxIf to standalone API
1 parent b58aa7b commit 8e2441a

7 files changed

+552
-663
lines changed

libs/template/if/src/lib/if.directive.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import {
6363
*/
6464
@Directive({
6565
selector: '[rxIf]',
66+
standalone: true,
6667
})
6768
// eslint-disable-next-line @angular-eslint/directive-class-suffix
6869
export class RxIf<T = unknown>

libs/template/if/src/lib/if.module.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { NgModule } from '@angular/core';
22
import { RxIf } from './if.directive';
33

4-
const DECLARATIONS = [RxIf];
4+
const EXPORTS = [RxIf];
55

6+
/** @deprecated use the standalone import, will be removed with v16 */
67
@NgModule({
7-
declarations: DECLARATIONS,
8-
imports: [],
9-
exports: DECLARATIONS,
8+
imports: EXPORTS,
9+
exports: EXPORTS,
1010
})
1111
export class IfModule {}

libs/template/if/src/lib/tests/if.directive.context-templates.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
throwError,
1818
} from 'rxjs';
1919
import { map, take, tap } from 'rxjs/operators';
20+
import { RxIf } from '../if.directive';
2021
import { IfModule } from '../if.module';
2122
import { createTestComponent, TestComponent } from './fixtures';
2223

@@ -70,7 +71,7 @@ const setupTestComponent = () => {
7071
},
7172
},
7273
],
73-
imports: [IfModule],
74+
imports: [RxIf],
7475
});
7576
};
7677

libs/template/if/src/lib/tests/if.directive.context.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
throwError,
1919
} from 'rxjs';
2020
import { map, take, tap } from 'rxjs/operators';
21+
import { RxIf } from '../if.directive';
2122
import { IfModule } from '../if.module';
2223
import { createTestComponent, TestComponent } from './fixtures';
2324

@@ -77,7 +78,7 @@ const setupTestComponent = () => {
7778
},
7879
},
7980
],
80-
imports: [IfModule],
81+
imports: [RxIf],
8182
});
8283
};
8384

0 commit comments

Comments
 (0)