簡體   English   中英

Ember.js didInsertElement在應用程序加載時出現問題

[英]Ember.js didInsertElement issue on application load

我在Ember.js中遇到上下文問題,不確定如何處理它。 newrecord和editrecord視圖使用didInsertElement加載外部庫。 但是,當我啟動我的應用程序時,用戶可以訪問他們的包含新消息的記錄,但是當我單擊這些記錄時,它的作用就好像庫尚未加載(他們可能沒有加載)一樣。

以下是我的路線...

App.Router.map(function() {
    this.resource('home', { path: '/'}); //<-- the links exist here here
    this.resource('form', { path: '/forms:form_id'}, function() {
        this.resource('editrecord', {path: '/:record_id/editrecord'}); //<-- the links go to here
    });
    this.resource('newrecord', { path: '/forms:form_id/newrecord' });

該應用程序從起始路徑開始,該路徑中存在指向記錄的鏈接(需要您進行編輯記錄)。 當我從初始頁面加載轉到這些鏈接時,庫似乎未加載。

但是,如果我導航到表單路線,然后單擊指向記錄的鏈接,則庫已加載,並且沒有任何錯誤。

有什么想法嗎?

可能您還忘記了在record_id中添加冒號

this.resource('editrecord', {path: '/:record_id/editrecord'});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM