简体   繁体   中英

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. The newrecord and editrecord views use didInsertElement to load external libraries. 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'});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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