Safe way to select the current ion-view element

Continuing the discussion from Please help test: Angular 1.3, improved transitions, cached views (repost):

When you use document.querySelectorAll('span'); it will select all elements from all ion-view, the only way to detect the current view, is to use the nav-view="active" attribute.

var currentView = document.querySelector('ion-view[nav-view="active"]');

currentView.querySelectorAll('span'); // Spans tags from the current view only

Shouldn’t $ionicHistory.currentView() give us the current view element?

Is ion-view[nav-view="active"] the only way to get the current view?

I’m afraid I’ll use nav-view attribute and in the future you change the values, attribute name or something else. Thanks.

I created an issue

I’m also looking for a solution, the above doesn’t work, in tabbed view.

I’m using tabs and this works for me:

$scope.$on('$ionicView.enter', function () {
            angular.forEach(document.querySelectorAll("ion-view"), function (element) {
                if (element['$attr-nav-view'] == 'entering' || element['$attr-nav-view'] == 'active') {
                    console.log('element is the active view');