Skip to main content

showToastMessage

showToastMessage

Displays a toast message at the bottom of the screen.

Parameters

  • toastType (String): The toast style. One of 'error', 'warning', 'success', 'notify'; any other value is shown in the default (normal) style.
  • message (String): The text content to display
  • duration (int or null): How long to show it, in milliseconds. null applies the default of 2000 ms (2 seconds).

Returns: void

Description

Shows a toast notification with an icon and a message at the bottom center of the screen. The toast's background color depends on toastType, and each type means the following.

toastTypeDescription
'error'An error occurred (error color)
'warning'A situation that needs attention (warning color)
'success'An operation succeeded (success color)
'notify'A general notification (notify color)
Any other valueDefault style (alertBackground color)

duration is specified in milliseconds, and the toast disappears automatically once that time elapses. Passing null applies 2000 ms.

Example

// 저장 성공 알림
$vm.showToastMessage("success", "저장되었습니다.", 2000);

// 입력값 오류 알림
$vm.showToastMessage("error", "필수 항목을 입력해주세요.", 3000);

// 경고 알림
$vm.showToastMessage("warning", "네트워크 상태가 불안정합니다.", 2000);

// 일반 알림 (기본 2초)
$vm.showToastMessage("notify", "데이터를 불러왔습니다.", null);

// 타입에 따라 동적으로 표시
const isSuccess = true;
$vm.showToastMessage(
isSuccess ? "success" : "error",
isSuccess ? "처리가 완료되었습니다." : "처리에 실패했습니다.",
2500
);

Related

  • $app.showLoadingIndicator — show a loading indicator at the app level.
  • $form.showLoadingIndicator — show a loading indicator at the current form level.