简体   繁体   English

Ember.js didInsertElement在应用程序加载时出现问题

[英]Ember.js didInsertElement issue on application load

I'm having a context issue within Ember.js and I'm not sure the way to handle it. 我在Ember.js中遇到上下文问题,不确定如何处理它。 The newrecord and editrecord views use didInsertElement to load external libraries. newrecord和editrecord视图使用didInsertElement加载外部库。 However, when I start my application the user has access to their records that have new messages, but when I click on these it's acting as if the libraries haven't loaded (which they probably havent'). 但是,当我启动我的应用程序时,用户可以访问他们的包含新消息的记录,但是当我单击这些记录时,它的作用就好像库尚未加载(他们可能没有加载)一样。

Below are the routes that I have.... 以下是我的路线...

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' });

The application starts on the home route where the links to the records (which takes you to editrecord) are present. 该应用程序从起始路径开始,该路径中存在指向记录的链接(需要您进行编辑记录)。 When I go from the initial page load to these links the libraries don't appear to be loaded. 当我从初始页面加载转到这些链接时,库似乎未加载。

However, if I navigate to the form route and then click on the links to the records the libraries are loaded and I'm not getting any errors. 但是,如果我导航到表单路线,然后单击指向记录的链接,则库已加载,并且没有任何错误。

Thoughts? 有什么想法吗?

可能您还忘记了在record_id中添加冒号

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM