javascript - cannot perform operations on a Metamorph that is not in the DOM -
so using ember 1.5.1 , ember-data 1.0.0 beta7
i have following routes
app.router.map -> @resource "items" @resource 'item', path: '/items/:id
item fetched server. these 2 routes work fine if start on route; weird thing happens when start on item page (/items/1), try navigate /items/ through link action handled function this.transitiontoroute("items") in itemcontroller. got following error:
attempting transition items ember.js?body=1:3524
transition #2: items: calling beforemodel hook ember.js?body=1:3524
transition #2: items: calling deserialize hook ember.js?body=1:3524
error while loading route: error: cannot perform operations on metamorph not in dom. @ metamorph.checkremoved (http://localhost:3000/assets/ember.js?body=1:27009:15) @ metamorph.html (http://localhost:3000/assets/ember.js?body=1:26979:12) @ object.dommanager.empty (http://localhost:3000/assets/ember.js?body=1:27974:16) @ object.ember.merge.empty (http://localhost:3000/assets/ember.js?body=1:25139:21) @ ember.collectionview.ember.containerview.extend.arraywillchange (http://localhost:3000/assets/ember.js?body=1:25962:25) @ object.sendevent (http://localhost:3000/assets/ember.js?body=1:2600:14) @ ember.array.ember.mixin.create.arraycontentwillchange (http://localhost:3000/assets/ember.js?body=1:15317:11) @ superfunction [as _super] (http://localhost:3000/assets/ember.js?body=1:7726:16) @ recordarray.extend.arraycontentwillchange (http://localhost:3000/assets/ember-data.js?body=1:7624:28) @ superwrapper [as arraycontentwillchange] (http://localhost:3000/assets/ember.js?body=1:1295:16)
transition #2: items: transition aborted
however, click on link again, , transition succeeds. works fine no matter how navigate between 2 routes.
my initial guess not records have been loaded, when try transition, though start on /items/ , go /items/1 try go /items/, still same error.
try this, add following code in action
ember.run.scheduleonce('afterrender', this, function(){ this.transitiontoroute("items"); });
update:
ok checked stacktrace. problem not because of transitiontoroute
. metamorph issue, little hard debug directly. may caused wrong handlebars expressions.
as pointed out in this link, simple issue can using html comment blocks.
{{! comment not in output }}
< !-- comment in output -- >manually manipulating dom. if manually remove script tags, then, won't found.
malformed html. let's left open div, metamorph-##-end tag nested @ different level start tag.
i have extracted lot of these points other questions think may you
Comments
Post a Comment