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

ObservableArray Angularjs Compatibility Problem

1 Answer 95 Views
Integration with other JS libraries
This is a migrated thread and some comments may be shown as answers.
Matthias
Top achievements
Rank 1
Matthias asked on 30 Nov 2016, 07:06 PM

Hello,

I am forced to use AngularJs Version 1.5.8 because of Angular Material compatibility. Kendo is delivered with angular version 1.4.6. 
When using kendo with AngularJs 1.5.8 I have a compatibility problem with the ObservablyArray and ng-repeat. Everything seems to work well except with an empty array. If the array is empty ng-repeat produces 3 empty rows when applied to a list as in the following code. With the older angular version 1.4.6 which comes with kendo that does not happen. Is it recommended at all to use angular version 1.5.8 with kendo? What can I do if I need both AngularJS and Angular Material in my kendo application and henceforth the latest angular version?

<body ng-app="myApp" ng-controller="myController">    
  <ul>
    <li ng-repeat="t in testArr">{{t.x}} : {{t.y}}</li>
  </ul>

  <script>
      angular.module('myApp',['kendo.directives']).controller('myController', ($scope)=>{
          $scope.testArr = new kendo.data.ObservableArray([]);
      });
  </script>
</body>

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 02 Dec 2016, 02:01 PM
Hello Matthias,

Thank you for the provided example.

After additional investigation, I noticed that there is a change in the ng-repeat behaviour from version 1.4.8 and if the array is empty it will use the array properties like length, _events and type.

The Kendo UI team has no control over this behaviour, but I can suggest using the ng-if directive to not show the ul element if the array is empty:

http://dojo.telerik.com/opaHa 

Let me know if you need additional information on this matter.

Regards,
Stefan
Telerik by Progress
Kendo UI is ready for Visual Studio 2017 RC! Learn more.
Tags
Integration with other JS libraries
Asked by
Matthias
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or