Skip to content

Commit 36a0cd3

Browse files
Popup: Update Angular Service Code Snippets (#8870) (#8872)
1 parent a78e096 commit 36a0cd3

1 file changed

Lines changed: 34 additions & 30 deletions

File tree

concepts/05 UI Components/Popup/10 Show and Hide the Popup/03 Using DxPopupService.md

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The `open` method returns a `DxPopupServiceComponent` object. This type extends
1212

1313
<!-- tab: app.component.ts -->
1414
import { DxPopupService } from 'devextreme-angular/ui/popup';
15+
1516
// ...
1617
export class AppComponent {
1718
employees: Employee[];
@@ -32,44 +33,46 @@ The `open` method returns a `DxPopupServiceComponent` object. This type extends
3233
showCloseButton: true,
3334
});
3435

35-
popupRef.contentRef.instance.currentEmployee = employee;
36+
popupRef.contentRef.instance.currentEmployee.set(employee);
3637
}
3738
}
3839

3940
<!-- tab: employee-info.component.ts -->
40-
import { Component, Input } from '@angular/core';
41+
import { Component, signal } from '@angular/core';
42+
4143
@Component({
4244
standalone: true,
4345
selector: '',
44-
template: `<div>
45-
<p>
46-
Full Name:
47-
<span>
48-
{{ currentEmployee['FirstName'] }}
49-
{{ currentEmployee['LastName'] }}
50-
</span>
51-
</p>
52-
<p>
53-
Birth Date:
54-
<span>{{ currentEmployee['BirthDate'] }}</span>
55-
</p>
56-
<p>
57-
Address:
58-
<span>{{ currentEmployee['Address'] }}</span>
59-
</p>
60-
<p>
61-
Hire Date:
62-
<span>{{ currentEmployee['HireDate'] }}</span>
63-
</p>
64-
<p>
65-
Position:
66-
<span>{{ currentEmployee['Position'] }}</span>
67-
</p>
68-
</div>`,
46+
template: `
47+
<div>
48+
<p>
49+
Full Name:
50+
<span>
51+
{{ currentEmployee()['FirstName'] }}
52+
{{ currentEmployee()['LastName'] }}
53+
</span>
54+
</p>
55+
<p>
56+
Birth Date:
57+
<span>{{ currentEmployee()['BirthDate'] }}</span>
58+
</p>
59+
<p>
60+
Address:
61+
<span>{{ currentEmployee()['Address'] }}</span>
62+
</p>
63+
<p>
64+
Hire Date:
65+
<span>{{ currentEmployee()['HireDate'] }}</span>
66+
</p>
67+
<p>
68+
Position:
69+
<span>{{ currentEmployee()['Position'] }}</span>
70+
</p>
71+
</div>
72+
`,
6973
})
70-
7174
export class EmployeeInfoComponent {
72-
@Input() currentEmployee: Record<string, any> = {};
75+
currentEmployee = signal<Record<string, unknown>>({});
7376
}
7477

7578
---
@@ -81,6 +84,7 @@ You can access the Popup instance through `DxPopupServiceComponent`. Call the [h
8184

8285
<!-- tab: app.component.ts -->
8386
import { DxPopupService, DxPopupServiceComponent } from 'devextreme-angular/ui/popup';
87+
8488
// ...
8589
export class AppComponent {
8690
employees: Employee[];
@@ -101,7 +105,7 @@ You can access the Popup instance through `DxPopupServiceComponent`. Call the [h
101105
width: 300
102106
});
103107

104-
this.popupRef.contentRef.instance.currentEmployee = employee;
108+
this.popupRef.contentRef.instance.currentEmployee.set(employee);
105109
}
106110

107111
closePopup() {

0 commit comments

Comments
 (0)