-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathHelloPanel.controller.ts
More file actions
27 lines (26 loc) · 1.05 KB
/
HelloPanel.controller.ts
File metadata and controls
27 lines (26 loc) · 1.05 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
import Controller from "sap/ui/core/mvc/Controller";
import MessageToast from "sap/m/MessageToast";
import JSONModel from "sap/ui/model/json/JSONModel";
import ResourceModel from "sap/ui/model/resource/ResourceModel";
import ResourceBundle from "sap/base/i18n/ResourceBundle";
import Dialog from "sap/m/Dialog";
/**
* @namespace ui5.walkthrough.controller
*/
export default class HelloPanel extends Controller {
private dialog : Dialog;
onShowHello(): void {
// read msg from i18n model
const recipient = (this.getView()?.getModel() as JSONModel)?.getProperty("/recipient/name");
const resourceBundle = (this.getView()?.getModel("i18n") as ResourceModel)?.getResourceBundle() as ResourceBundle;
const msg = resourceBundle.getText("helloMsg", [recipient]) as string;
// show message
MessageToast.show(msg);
}
async onOpenDialog(): Promise<void> {
this.dialog ??= await this.loadFragment({
name: "ui5.walkthrough.view.HelloDialog"
}) as Dialog;
this.dialog.open();
}
};