Embedded form: change the message "camForm submission prevented" once the form is prevented for submission

Hi @nikolaosnousias,

I forgot to mention that Notifications and $timeout services should be injected.
Kindly find below updated snip of code

inject(['$scope', 'Notifications', '$timeout', function ($scope, Notifications, $timeout) {

            camForm.on('submit-failed', function (evt, res) {
                var errMsg;

                errMsg = res[0];
                if (evt.submitPrevented) {
                    errMsg = '<YOUR ERR MSG>';
                }

                $timeout(function () {
                    Notifications.clearAll();

                    Notifications.addError({
                        status: 'Error',
                        message: errMsg,
                        scope: $scope
                    })
                });
            });
        }
    ]);
2 Likes