Set focus on new page in Tizen Caph 3.0 Angular

797 views Asked by At

I'am developing Tizen TV app using Caph 3.0 library. And i can't set focus manually when i relocating to the new page. For example i have page with next code:

HTML

<a href="" ui-sref='home' >Movies</a>
<a href="" ui-sref='series'>Series</a>

When i clicking on Series link - new page with next code appears

<a href="" focusable on-focused='seriesCtrl.focusedItem($event)' id='1'>test element1</a>
<a href="" focusable on-focused='seriesCtrl.focusedItem($event)'id='2'>test element1</a>
<a href="" focusable on-focused='seriesCtrl.focusedItem($event)' id='3'>test    element1</a>

But i lost the focus. I can't navigating on that new page using arrow Keys (emulator) I tried set focus manually using focusController.focus() but it does not helped me. I using ControllerAs syntax.

Controller of new page

focusController.focus(document.getElementById('1'));

console.log(focusController.getCurrentFocusItem()); ----- In this place console shows that focus still on Series link from previous page

vm.focusedItem = function ($event) {
 console.log($event.currentTarget)
}

Where i made a mistake? Thank you.

1

There are 1 answers

0
George Airbeem On

Finally resolved. Thanks to CAPH support.

Try

App.controller("DetailPageCtrl", ['$rootScope', '$scope', 'focusController', 'FocusUtil', function($rootScope, $scope, focusController, FocusUtil) {
function initFocus() {
                        $scope.$applyAsync(function() {
                            FocusUtil.isElement($('#1')) && focusController.focus($('#1'));
                        });
                    }
$scope.$on('$viewContentLoaded', function() {
                        console.log("jj apply async $viewContentLoaded");
                        initFocus();
                    });

....... }])

P:S: Also check ng-controller does not belong to < body > tag