This is a migrated thread and some comments may be shown as answers.

How to access external scripts

1 Answer 83 Views
Templates
This is a migrated thread and some comments may be shown as answers.
Sylvain
Top achievements
Rank 1
Sylvain asked on 31 Jul 2015, 04:54 AM

My app is written with aurelia. This uses systemjs and modules are ​isolated (no globals). I need to use a helper in one of my kendo template but loading the helper module returns a promise. By the time the ​promise resolves kendo has already ​executed the template (blank).

Is there a way to tell kendo to wait ?  

<script type="text/x-kendo-template">
  <div>
    #
    System.import('template-helpers').then(function(module){
      var h = new module.TemplateHelper();
      h.format(data)
    });
    #
   </div>
</script>

1 Answer, 1 is accepted

Sort by
0
Accepted
Petyo
Telerik team
answered on 03 Aug 2015, 07:22 AM

Hello Sylvain,

the kendo templates implementation is a synchronous one. Actually, the template is a function which gets called with the corresponding data and returns the string output. The only way to perform ajax request, load script, and execute it would be to make the ajax request a synchronous one. However, I would not recommend that (not sure if it is possible with system.js in fact) - you should load the respective modules beforehand and execute the template afterwards.

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Templates
Asked by
Sylvain
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or