0

I'm implementing the smart message box from SmartAdmin in my Angular 5 project. I'm getting the error that SmartMessageBox is not a function in jquery.

I didn't find a solution on stack overflow, the rest of the internet nor in the SmartAdmin documentation. My colleague said it could be a jquery plugin, but I can't find where it is implemented.

How do I fix the error?

TypeError: $.SmartMessageBox is not a function
at NotificationService.smartMessageBox (notification.service.ts:21)
Janneman96
  • 374
  • 1
  • 8
  • 24
  • *How do I fix the error?* Read the error message, it says it all. – Aniket Sahrawat Mar 07 '18 at 09:58
  • @AniketSahrawat That's the first thing I did. It just tells me the property isn't a function. It does that only in my project and not in the SmartAdmin project. Somewhere in the SmartAdmin project, this function must have been set, but I can't find where it is set. I'm using the function in the same way as in the SmartAdmin project. – Janneman96 Mar 07 '18 at 10:00

2 Answers2

0

In Smartadmin these is a minor bug and You can just try this

$.smallBox({
  title: "Synced Successfully",
  content: " Data Synced Done",
  color: "#659265",
  iconSmall: "fa fa-check fa-2x fadeInRight animated",
  timeout: 4000
});
$.fn.size = function () {
};

Hope this will help for you

Sankar Smith
  • 338
  • 1
  • 5
  • 14
0

I had the same problem. I skipped the function and did it hardcoded using a boolean

this is the code they generate with there function.

white the *ngIf you can decide when you show the message box.

<div *ngIf="showMessageBox" class="divMessageBox animated fadeIn fast" id="MsgBoxBack">
<div class="MessageBoxContainer animated fadeIn fast" id="Msg1">
    <div class="MessageBoxMiddle"><span class="MsgTitle"><i class="fa fa-sign-out txt-color-orangeDark"></i> Logout <span
            class="txt-color-orangeDark"><strong>


                    {{userName}}

        </strong></span> ?</span>
        <p class="pText">Some text.</p>
        <div class="MessageBoxButtonSection">
            <button id="bot1-Msg1" class="btn btn-default btn-sm botTempo" (click)="cancel()"> No</button>
            <button id="bot2-Msg1" class="btn btn-default btn-sm botTempo" (click)="confirm()"> Yes</button>
        </div>
    </div>
</div>

Pieter Samoy
  • 80
  • 1
  • 8