Ember eror尝试注册已使用id的视图

时间:2016-04-13 09:33:40

标签: javascript ember.js

有没有人注意到Ember app中的错误,并显示以下消息;

“断言失败:尝试注册已使用ID的视图:MyGridId”

知道我应该在哪里寻找?

1 个答案:

答案 0 :(得分:0)

如果我理解正确,您尝试将var html = '<html>...<img class="someclass" src="a"></img>...<a><img src="b"></img></a></html>'; var count = (html.match(/<img/g) || []).length; //number of img tags var curSources = ['a','b']; var newSources = ['c','d']; for (i=1; i<=count; i++) { a = html.split('<img', i).join('<img').length; //index of i'th occurance of <img b = html.indexOf('src',a); //index of i'th occurance of src c = html.substring(a,b+5); //split from <img to src=" html = html.replace(c+curSources[i-1]+'"',c+newSources[i-1]+'"'); } alert(html);变量指定为MyGridId

我想找一个id并在模板中替换为id="MyGridId"