无效段的离子错误页面

时间:2017-11-14 20:17:10

标签: ionic-framework ionic3

我不喜欢我可以转到http://localhost:8100/#/asdfasd并获得正常的起始页面。我希望这是一个错误页面。

我尝试通过创建NoSuchPageComponent并将rootPage设置为AppComponent中的NoSuchPageComponent#ionViewDidEnter来实现此目的。 (当没有片段时,我也Runtime Error Uncaught (in promise): invalid views to insert Stack Error: Uncaught (in promise): invalid views to insert at c (http://localhost:8100/build/polyfills.js:3:18260) at Object.reject (http://localhost:8100/build/polyfills.js:3:17682) at NavControllerBase._fireError (http://localhost:8100/build/vendor.js:46029:16) at NavControllerBase._failed (http://localhost:8100/build/vendor.js:46017:14) at http://localhost:8100/build/vendor.js:46072:59 at t.invoke (http://localhost:8100/build/polyfills.js:3:13979) at Object.onInvoke (http://localhost:8100/build/vendor.js:4248:33) at t.invoke (http://localhost:8100/build/polyfills.js:3:13919) at r.run (http://localhost:8100/build/polyfills.js:3:9146) at http://localhost:8100/build/polyfills.js:3:18750 Ionic Framework: 3.7.0 Ionic App Scripts: 3.0.1 Angular Core: 4.4.3 Angular Compiler CLI: 4.4.3 Node: 6.12.0 OS Platform: macOS Sierra Navigator Platform: MacIntel User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.89 Safari/537.36 导航到主页。)

这在浏览器导航到http://localhost:8100/#/asdfasd时有效,但如果我首先打开任何实际页面然后将地址栏更改为http://localhost:8100/#/asdfasd,我会得到Ionic错误处理程序,显示“未捕获(在承诺中) :无效的视图插入“

  1. 预计会有另一种方式吗?
  2. 有什么地方可以捕捉到这个错误吗?
  3. 这与延迟加载有关吗?
  4. 如何按照我的意愿开展此工作?

    以下是完整的错误消息:

    class Group(db.Model):
        #data
        id=db.Column(db.Integer, primary_key=True)
        name=db.Column(db.String(32), nullable=False)
        #relationships
        parent_id=db.Column(db.Integer, db.ForeignKey('group.id'))
        children=db.relationship('Group', backref=db.backref('parent', remote_side=[id]))
    
        def rank(self, count, parent):
            if parent.parent:
                count=count+1
                parent.rank(count, parent.parent)
            else:
                return count
    

0 个答案:

没有答案