How to access external scripts

2 posts, 1 answers
  1. Sylvain
    Sylvain avatar
    24 posts
    Member since:
    Feb 2011

    Posted 30 Jul 2015 Link to this post

    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>

  2. Answer
    Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 03 Aug 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top