在Angular 2模板中使用普通的POST表单会导致:"模板解析错误:没有ControlContainer的提供者"

bal*_*teo 1 angular2-forms angular2-template 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>
Run Code Online (Sandbox Code Playgroud)

在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)
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?

Gün*_*uer 7

添加ngNoForm以获取本机行为:

<form ngNoForm action="connect/facebook" method="POST">
Run Code Online (Sandbox Code Playgroud)