Angular get selected tab index on compile/load/select returns -1

3 posts, 0 answers
  1. tom
    tom avatar
    13 posts
    Member since:
    Nov 2013

    Posted 04 Aug 2014 Link to this post

    So, I am upgrading to the latest kendo.all package (2014.2.716) and code that was previously working with angular-kendo.js is now failing.  The setup we have is a main tab container with a set of tabs and each tab points to a templateUrl.  When the templateUrl is loaded, I check the currently selected tab and get its index and pull out configuration information from the tab datasource.

    The new code compiles the templateUrl prior to completing the so if I try to pull out it returns a -1.  Clearly this method will not work.  Is there a preferred way to get the currently selected tab configuration when that templateUrl is compiled.  If I put in a timeout of 500ms, the select().index() returns as it did before, but I would prefer not to stick my page with timeout's.

    Code prior was like this:

    var tabStrip =  $scope.$parent.vm.kendoTabStrip;
    vm.tabDataSource = $scope.$;   // now returns - 1
    vm.template = vm.tabDataSource.template;  // contains configuration, and no i don't want to retrieve it on this html page as it is dynamic 

    Let me know what my options are here, thanks.
  2. tom
    tom avatar
    13 posts
    Member since:
    Nov 2013

    Posted 04 Aug 2014 in reply to tom Link to this post

    If anyone cares, my workaround was adding a k-on-select event and setting the selected index of the tab on the scope.  Then read the selected index from the parent scope.

    parent tab container:
      vm.tabStripSelect = function (e) {
                var selectedIndex = $(e.item).index();
                vm.selectedTabIndex = selectedIndex;

    child template:
    vm.tabDataSource = $scope.$$scope.$parent.vm.selectedTabIndex);

  3. Mihai
    Mihai avatar
    153 posts

    Posted 06 Aug 2014 Link to this post

    Hi Tom,

    I pushed a fix that restores the previous behavior.  It will be available in the next build.

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top