-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.component.ts
More file actions
57 lines (48 loc) · 1.28 KB
/
Copy pathapp.component.ts
File metadata and controls
57 lines (48 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import {Component, inject, input} from '@angular/core';
import {RouterOutlet} from '@angular/router';
import {injectQuery} from "@tanstack/angular-query-experimental";
import {NgbModal} from "@ng-bootstrap/ng-bootstrap";
@Component({
selector: 'app-test',
standalone: true,
imports: [],
template:`
<!-- This doesn't fail-->
<!-- {{ someInput() }}-->
<!-- You get NG0950: Input is required but no value is available yet even if you remove this line-->
<h1>{{ query.isPending() }} | {{ query.data() }}</h1>
`
})
export class TestComponent {
someInput = input.required<string>();
query = injectQuery(() => ({
queryKey: ['FANCY_KEY', this.someInput()],
queryFn: () => Promise.resolve(this.someInput())
}))
}
@Component({
selector: 'app-modal',
standalone: true,
imports: [TestComponent],
template: `
<app-test [someInput]="'test'"/>
<!-- That works somehow-->
<!-- <app-test someInput="test"/>-->
`
})
export class TestModal {
}
@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet, TestComponent, TestModal],
template: `
<button (click)="showModal()">Open</button>
`
})
export class AppComponent {
modalService = inject(NgbModal);
showModal() {
this.modalService.open(TestModal);
}
}