Angular2: Exception "No provider for t!" when creating a form
<div id="my-form" class="form-inline">
<div class="form-group">
<input type="text" [(ngModel)]="name" ngControl="name" #n="ngForm" required>
<div [hidden]="n.valid" class="alert alert-danger">
Value is required
</div>
</div>
</div>
I get the following (less useful) error with alpha .52:
EXCEPTION: There is no provider for t! (t-> t)
+4
1 answer
Angular registers controls under the ngControl names with NgForm. Usually you do not need to explicitly specify the NgForm directive, because it is automatically added - if you use an element <form>. But you don't have an element <form>(which BTW is valid / accurate regarding Twitter Bootstrap ... but not Angular). So, change the external <div>to <form>:
<form id="my-form" class="form-inline">
Or add the NgForm directive:
<div ngForm id="my-form" class="form-inline">
+4