未捕获的错误:断言失败:尝试注册具有已在使用的ID的视图:name [英] Uncaught Error: Assertion Failed: Attempted to register a view with an id already in use: name

查看:55
本文介绍了未捕获的错误:断言失败:尝试注册具有已在使用的ID的视图:name的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我随机开始收到此错误未捕获的错误:断言失败:尝试使用ember-cli在我的应用程序中注册一个已经使用了ID:name 的视图.我只有两条路线

I randomly started getting this error Uncaught Error: Assertion Failed: Attempted to register a view with an id already in use: name on my app using ember-cli. I have only two routes

Router.map(function() {
  this.route('buy');
  this.route('rent');
});

没有控制器,我的索引路由将我重定向到购买

no controllers, my index route redirects me to buy

redirect: function() {
  this.transitionTo('buy');
}

和我的 rent 路线也呈现了 buy 模板

and my rent route also renders the buy template

renderTemplate: function() {
  this.render('buy');
}

我没有 rent index 模板.我不知道这个错误是从哪里来的.

I don't have a rent or index template. I have no idea where this error is coming from.

推荐答案

我弄清楚了为什么,原来我的模板上有两个输入具有相同的ID, {{输入名称=名称" id =名称"占位符=全名" class =全角"}} 在不同的位置两次.如果错误消息可以提供更多信息,并在您的实际代码上给您一行,而不是仅在您的行上显示 throw new EmberError("Assertion Failed:" + desc); code> vendor.js 文件.

I figured out why, turns out I had two inputs with the same id on my template, {{ input name="name" id="name" placeholder="Full Name" class="full-width" }} twice in different places. It would be useful if the error message could be more informative and give you a line on your actual code instead of showing just the line throw new EmberError("Assertion Failed: " + desc); on you vendor.js file.

这篇关于未捕获的错误:断言失败:尝试注册具有已在使用的ID的视图:name的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆