10000 feat(template): migrate RxFor to standalone API · rx-angular/rx-angular@b58aa7b · GitHub
[go: up one dir, main page]

Skip to content

Commit b58aa7b

Browse files
committed
feat(template): migrate RxFor to standalone API
1 parent e7c379b commit b58aa7b

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ declare const ngDevMode: boolean;
7676
*/
7777
@Directive({
7878
selector: '[rxFor][rxForOf]',
79+
standalone: true,
7980
})
8081
// eslint-disable-next-line @angular-eslint/directive-class-suffix
8182
export class RxFor<T, U extends NgIterable<T> = NgIterable<T>>
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import { NgModule } from '@angular/core';
22
import { RxFor } from './for.directive';
33

4-
const DECLARATIONS = [
5-
RxFor
6-
];
4+
const EXPORTS = [RxFor];
75

6+
/** @deprecated use the standalone import, will be removed with v16 */
87
@NgModule({
9-
declarations: DECLARATIONS,
10-
imports: [],
11-
exports: DECLARATIONS
8+
imports: EXPORTS,
9+
exports: EXPORTS,
1210
})
13-
export class ForModule {
14-
}
11+
export class ForModule {}

libs/template/for/src/lib/tests/for.directive.observable.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
44
import { By } from '@angular/platform-browser';
55
import { RX_RENDER_STRATEGIES_CONFIG } from '@rx-angular/cdk/render-strategies';
66
import { Observable } from 'rxjs';
7+
import { RxFor } from '../for.directive';
78
import { ForModule } from '../for.module';
89
import {
910
createErrorHandler,
@@ -49,7 +50,7 @@ describe('rxFor with observables', () => {
4950
beforeEach(() => {
5051
TestBed.configureTestingModule({
5152
declarations: [TestComponent],
52-
imports: [CommonModule, ForModule],
53+
imports: [CommonModule, RxFor],
5354
providers: [
5455
{
5556
provide: ErrorHandler,

libs/template/for/src/lib/tests/for.directive.parent-notification.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe('rxFor parent-notifications', () => {
7979
beforeEach(() => {
8080
TestBed.configureTestingModule({
8181
declarations: [ParentNotifyTestComponent],
82-
imports: [ForModule],
82+
imports: [RxFor],
8383
teardown: { destroyAfterEach: true },
8484
});
8585
fixture = TestBed.createComponent(ParentNotifyTestComponent);

libs/template/for/src/lib/tests/for.directive.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ErrorHandler } from '@angular/core';
22
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
33
import { By } from '@angular/platform-browser';
44
import { RX_RENDER_STRATEGIES_CONFIG } from '@rx-angular/cdk/render-strategies';
5+
import { RxFor } from '../for.directive';
56
import { ForModule } from '../for.module';
67
import {
78
createErrorHandler,
@@ -37,7 +38,7 @@ describe('rxFor', () => {
3738
beforeEach(() => {
3839
TestBed.configureTestingModule({
3940
declarations: [TestComponent],
40-
imports: [ForModule],
41+
imports: [RxFor],
4142
providers: [
4243
{
4344
provide: ErrorHandler,

libs/template/for/src/lib/tests/for.directive.strategy.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ErrorHandler } from '@angular/core';
22
import { ComponentFixture, TestBed } from '@angular/core/testing';
33
import { RxStrategyProvider } from '@rx-angular/cdk/render-strategies';
4+
import { RxFor } from '../for.directive';
45
import { ForModule } from '../for.module';
56
import { createTestComponent, TestComponent } from './fixtures';
67

@@ -24,7 +25,7 @@ describe('rxFor strategies', () => {
2425
beforeEach(() => {
2526
TestBed.configureTestingModule({
2627
declarations: [TestComponent],
27-
imports: [ForModule],
28+
imports: [RxFor],
2829
});
2930
fixture = createTestComponent(
3031
`<div><span *rxFor="let item of items; strategy: strategy; renderCallback: renderedValue$">{{item.toString()}};</span></div>`

0 commit comments

Comments
 (0)
0