MVVM View, evalTemplate

4 posts, 0 answers
  1. Carsten Koster
    Carsten Koster avatar
    25 posts
    Member since:
    Sep 2006

    Posted 04 Dec 2014 Link to this post

    Hey just a quick thing,

    I tried to use a kendo.View fed by html containing kendo-template expressions:
     var viewModel = kendo.observable({       
            test: '123'
    myFailedView = new kendo.View('<span data-bind="text: test"></span> #: location.href #', { model:viewModel, evalTemplate: true });

    var mySucessfulView = new kendo.View('##<span data-bind="text: test"></span> #: location.href #', { model:viewModel, evalTemplate: true });

    I would expect it to render  a span with 123 followed by the current location of the browser. But it only renders the span. If I start with an empty template expression "##" it behaves as expected. Is that a bug or did I miss something in the documentation?

    For reference see JsFiddle


  2. Petyo
    Petyo avatar
    2444 posts

    Posted 05 Dec 2014 Link to this post

    Hello Carsten,

    Thank you for the reproduction. This is a known issue, but due to its relatively limited usage we have not investigated it further. The evalTemplate will work as expected if the view is created from a script template. Our API reference shows this approach

    I will log the problem in our GitHub repository, we will try to address it shortly. 
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Elvis
    Elvis avatar
    19 posts
    Member since:
    Feb 2015

    Posted 31 Jan 2017 Link to this post

    Hello there, 

        We faced with issue, related to evalTemplate: true. In details,  We used it for compiling template and binding to MVVM model. The problem is that it compiles only first time (the time when the view is initialized) and then it uses the compiled version with MVVM model, that is already changed. Here is the dogo, that demonstrates this behaviour: . I know, we could fix it by separating the MVVM and kendo template and then use kendo.template and kendo.bind manually, but may be I missed something?

  4. Stefan
    Stefan avatar
    3067 posts

    Posted 02 Feb 2017 Link to this post

    Hello Elvis,

    After investigating the scenario I can confirm that this is currently a limitation.

    The provided workaround can be used in this scenario.

    Thank you for sharing it with the community.

    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top