TypeError issue with angularjs ngIf

140 Views Asked by At

I have a simple ng-click event on a header that, when clicked, will hide the ng-repeat section from view. When you click the header again, the ng-repeat section will reappear. I also have a kendo-date-time-picker attribute on an input element that's in an ng-repeat:

<h3 data-ng-click="hide=!hide">Unclaimed Orders</h3>

<div data-ng-if="!hide">
    <section data-ng-repeat="row in vm.vom">
        <input kendo-date-time-picker k-format="'MM/dd/yy h:mm tt'" data-ng-model="row.needed_date">
    </section>
</div>

Whenever I click on that header, a TypeError message is logged into the console, and I'm not sure why it's doing so:

kendo error

Anyone else experience this issue and found a way to solve it?

If I use ngShow instead of ngIf the error isn't produced. Why though does the error persist with ngIf? Does it not like being removed from the DOM and then added back?

2

There are 2 best solutions below

1
On

What scripts are you including of kendo? Try including kendo.all.min.js and if that works than it's possible the you forgot one script.

By the looks of the error, you might have forgotten kendo.data.min.js

0
On

Geez, what a joke. I assumed that Kendo UI relied on a jquery dependency which already comes with the CMS I'm working in (Concrete5). Concrete's jquery.min.js file is probably an older version so I needed to reference the most up-to-date one.

From the dateTimePicker demo page, I clicked on the 'Edit this example' button and it took me to their UI Dojo (akin to jsFiddle/codepen etc.) where I grabbed their latest jquery dependency:

<script src="http://cdn.kendostatic.com/2015.1.429/js/jquery.min.js"></script>

I put it in my header and voila, issue solved, TypeError message never appearing again.