我想在 angular 2 模板中有一个纯 html 表单(不依赖 javascript 执行 POST)。
具有以下纯 POST 形式:
<form action="connect/facebook" method="POST">
<input type="hidden" name="scope" value="public_profile,email"/>
<button type="submit">Connect to FB</button>
</form>
在 html 模板中导致以下错误:
Template parse errors: No provider for ControlContainer ("
<h2 class="text-xs-center">{{'SIGNIN_FORM.TITLE' | translate}}</h2>
[ERROR ->]<form action="connect/facebook" method="POST">
<input type="hidden" name="scope" value="pub"): SigninComponent@6:8 ; Zone: <root> ; Task: Promise.then ; Value:
Error: Template parse errors: No provider for ControlContainer ("
<h2 class="text-xs-center">{{'SIGNIN_FORM.TITLE' | translate}}</h2>
[ERROR ->]<form action="connect/facebook" method="POST">
<input type="hidden" name="scope" value="pub"): SigninComponent@6:8
at TemplateParser.parse (http://localhost:8080/main.bundle.js:20619:19)
at RuntimeCompiler._compileTemplate (http://localhost:8080/main.bundle.js:42414:51)
at http://localhost:8080/main.bundle.js:42337:83
at Set.forEach (native)
at compile (http://localhost:8080/main.bundle.js:42337:47)
at ZoneDelegate.invoke (http://localhost:8080/main.bundle.js:60992:29)
at Zone.run (http://localhost:8080/main.bundle.js:60885:44)
at http://localhost:8080/main.bundle.js:61240:58
at ZoneDelegate.invokeTask (http://localhost:8080/main.bundle.js:61025:38)
at Zone.runTask (http://localhost:8080/main.bundle.js:60925:48)
有人可以帮忙吗?
最佳答案
添加 ngNoForm
以获得 native 行为:
<form ngNoForm action="connect/facebook" method="POST">
关于angular - 在 Angular 2 模板中使用普通 POST 表单会导致 : "Template parse errors: No provider for ControlContainer",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39453681/