angularjs

无法绑定到“ ngModel”,因为它不是“ input”的已知属性

…衆ロ難τιáo~ 提交于 2020-10-16 08:55:22
问题: I've got the following error when launching my Angular app, even if the component is not displayed. 即使未显示组件,启动我的Angular应用程序时也会出现以下错误。 I have to comment out the <input> so that my app works. 我必须注释掉 <input> 这样我的应用才能正常工作。 zone.js:461 Unhandled Promise rejection: Template parse errors: Can't bind to 'ngModel' since it isn't a known property of 'input'. (" <div> <label>Created:</label> <input type="text" [ERROR ->][(ngModel)]="test" placeholder="foo" /> </div> </div>"): InterventionDetails@4:28 ; Zone: <root> ; Task: Promise.then ; Value: I'm looking at the Hero plunker, but I don't see any

如何设置对输入字段的关注?

孤街醉人 提交于 2020-10-16 06:11:57
问题: What is the 'Angular way' to set focus on input field in AngularJS? 在AngularJS中将焦点设置在输入字段上的“角度方式”是什么? More specific requirements: 更具体的要求: When a Modal is opened, set focus on a predefined <input> inside this Modal. 打开 模态后 ,将焦点放在此模态内的预定义 <input> 。 Everytime <input> becomes visible (eg by clicking some button), set focus on it. 每当 <input> 变为可见时(例如,通过单击某些按钮),请将焦点设置在它上面。 I tried to achieve the first requirement with autofocus , but this works only when the Modal is opened for the first time, and only in certain browsers (eg in Firefox it doesn't work). 我试图 通过 autofocus 达到第一个要求