We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

"str.match is not a function" error while using toast

Hi. I've recently installed 'ej2-angular-notifications' package and in one of my component I have a toast component but when I call the show() method of the toast it doesn't appear and it throws str.match is not a function error.

here's my code:

<ejs-toast #msg (created)="showToast($event) [position]='toastPos' ">
     <ng-template  #title>
      <ng-template  #content>

toastPos = { X:'Right'};
@ViewChild('msg', {static:false}) toast : ToastComponent;

how can I fix it?

3 Replies

NP Narayanasamy Panneer Selvam Syncfusion Team August 6, 2019 12:46 PM UTC

Hi Nastaran, 
Greetings from Syncfusion support. 
We have validated your query and code snippet. From the shared code snippet, we have found there is problem in your [component.html] code. 
<ejs-toast #msg (created)="showToast($event) [position]='toastPos' "> 
Please make sure that you have closed all the quotation mark properly. 
We have prepared a demo sample to meet your requirement.  
Further if you are facing same error after modifying the sample based on shared sample, then we suggest you the following solution.

-      Run npm dedupe – remove old package from application 
-          Delete package-lock.json 
-          Now run npm install 

Kindly let us know if you need further assistance on this.
Narayanasamy P. 

NH Nastaran Heydari August 7, 2019 05:06 AM UTC

The type is not in my project. It was just here. and I tried to update my syncfusion projects but there's still that error.
I run npm dedupe command but nothing happened. and because my project is located in a computer that can't be connected to internet I can't run npm install in it. I have to install packages in another computer and move them to this computer.

NP Narayanasamy Panneer Selvam Syncfusion Team August 7, 2019 06:09 PM UTC

Hi Nastaran, 
Thanks for your update. 
We have validated your query. Please find the details in below, 
Generally, the mentioned issue arise due to referring duplicate packages or deprecated packages. So, could you please ensure the below steps in machine which is connected to internet and generate node_modules? 
·       Remove ‘@syncfusion” folder from node_modules 
·       Ensure the all the version in package.json file 
·       Now, generate the node_modules using npm install 
·       Copy the node_modules and use it in your machine 
Still, you face the issue, kindly share the below details that will be helpful for us to provide a better solution as early as possible. 
1.       Share your project package.json file from machine (which you generate node_modules). 
2.       Share sample or code block which is used in your application to render toast component. 
Narayanasamy P.  

Live Chat Icon For mobile
Up arrow icon