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

Strange problems with using MVVM bindings with templates

1 Answer 58 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Keith
Top achievements
Rank 1
Keith asked on 19 May 2014, 01:48 PM
I'm trying to bind a pretty simple model to a template and keep getting an error "Cannot read property 'replace' of undefined".   Please see the following fiddle:
http://jsfiddle.net/keithnolan/2EN3m/3/

I've tried to create an even simpler example in the below fiddle 
http://jsfiddle.net/keithnolan/2EN3m/1/

This also doesn't work but doesn't give any error.  If I remove everything except one single input then it works.  I'm guessing I'm missing something pretty obvious in the above examples.

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 20 May 2014, 08:27 AM
Hello Keith,

I noticed that the template ID does not match the one provided as a value of the data-template attribute.

  <script id="div-template" type="x-kendo-template">
        <div style="height:500px" >
            <div class="k-edit-label">
                <label for="ViewName">Name</label>
            </div>   
            <div data-container-for="ViewName" class="k-edit-field">
                <input type="text" class="k-input k-textbox" name="ViewName" data-bind="value: ViewName">
            </div>                
        </div>
         
    </script>
</head>
<body>
  <div id="bodyDiv" >               
      <div id="visDiv" data-template="popupSummaryEditor" data-bind="source: summaryDef" >                       
      </div>      
    </div>
</body>

Please fix that and the error should not appear any more.

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