在离子变化路线中导致& quot; TypeError:无法读取属性' scrollTo'的"null" [英] in ionic changing route causes "TypeError: Cannot read property 'scrollTo' of null"

查看:28
本文介绍了在离子变化路线中导致& quot; TypeError:无法读取属性' scrollTo'的"null"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面,当我单击搜索图标"时,以下内容会在控制台中弹出

In the following, when I click on "search icon", the following pops up in console

TypeError: Cannot read property 'scrollTo' of null
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:39909:17
at wrappedCallback (http://localhost:8100/lib/ionic/js/ionic.bundle.js:19197:81)
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:19283:26
at Scope.$eval (http://localhost:8100/lib/ionic/js/ionic.bundle.js:20326:28)
at Scope.$digest (http://localhost:8100/lib/ionic/js/ionic.bundle.js:20138:31)
at Scope.$apply (http://localhost:8100/lib/ionic/js/ionic.bundle.js:20430:24)
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:21938:36
at completeOutstandingRequest (http://localhost:8100/lib/ionic/js/ionic.bundle.js:12022:10)
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:12330:7

我在 body 标记中有以下内容

<ion-header-bar class="logo-bar">
    <button class="button button-clear">
        <a ui-sref="root.home"><img class="pull-left" src="img/X.png"></a>
    </button>
    <h1 class="title">
        <a ui-sref="root.search" class="icon ion-search" nav-clear></a>
    </h1>
</ion-header-bar>

<ion-nav-view name="rootContent" class="main-body" animation="slide-left-right">
</ion-nav-view>

我的主页 rootContent 内容如下:

<ion-side-menus>
    <ion-side-menu-content>
        <ion-nav-bar class="app-menu bar-stable" animation="nav-title-slide-ios7" title="">
        </ion-nav-bar>
        <ion-view name="mainContent">
            <ion-content>
                This tag breaks click on SEARCH. Remove ion-content and it will work OK
            </ion-content>
        </ion-view>
    </ion-side-menu-content>
</ion-side-menus>

如果要删除上面的 ion-content 标签,该错误消失.我想知道它有什么问题以及如何解决.

If I were to remove ion-content tag in the above, the error disappears. I am wondering what's wrong with it and how to fix it.

-编辑

搜索点击会插入 rootContent 中的以下内容,然后过渡到此位置:

The search click plugs in the below in rootContent, transitioning to this is where it breaks:

<ion-view>
  <div class="list list-inset">
    <label class="item item-input">
        <i class="icon ion-search placeholder-icon"></i>
        <input type="text" placeholder="Search" ng-model="searchTerm" ng-change="doSearch(searchTerm)">
    </label>
  </div>
 </ion-view>

推荐答案

这是Ionic beta 12中的错误.

This is a bug in Ionic beta 12.

它已在临近的版本中修复(离子beta 13)

Its fixed in the nighly build (ionic beta 13)

下载Nightly Build

立即构建changlog

了解有关该错误的更多信息

这篇关于在离子变化路线中导致&amp; quot; TypeError:无法读取属性&amp;#39; scrollTo&amp;#39;的"null"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆