我遇到了Angular 4和html的问题。我先得到意想不到的结束标签。当我删除表单结束标记,然后我得到相同的错误,但有。 顺便说一句,我是新手,所以这可能是一个非常愚蠢的错误。这是代码,谢谢!
<div class="app flex-row align-items-center">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card mx-2">
<div class="card-block p-2">
<h1>Register</h1>
<p class="text-muted">Create your account</p>
<form *ngIf="creatingUser"
class="example-form"
(ngSubmit)="onSubmit(userForm)"
#userForm="ngForm"
fxFlexFill [fxLayout]="'row'"
fxLayoutAlign="center start">
<div class="input-group mb-1">
<span class="input-group-addon"><i class="icon-user"></i></span>
<input type="text" fxFlex="100"
required
minlength="3"
placeholder="Username"
[(ngModel)]="user.profile.username"
name="username"
#username="ngModel">
</div>
<div class="input-group mb-1">
<span class="input-group-addon">@</span>
<input type="text" placeholder="Email" name="email" #email="ngModel" id="email"
required
pattern="^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$"
placeholder="Email"
[(ngModel)]="user.profile.email">
</div>
<div class="form-group row">
<label class="col-md-3 form-control-label" for="select">Select role</label>
<div class="col-md-9">
<select id="select" name="select" size="1" placeholder="Role" [(ngModel)]="user.role" name="role">
<option *ngFor="let role of roles" [value]="role">{{role.name}}</option>
</select>
</div>
</div>
<div class="input-group mb-1">
<span class="input-group-addon"><i class="icon-lock"></i></span>
<input type="password" placeholder="Password" name="password" #password="ngModel"
required
minlength="6"
[(ngModel)]="user.password">
</div>
<div class="input-group mb-2">
<span class="input-group-addon"><i class="icon-lock"></i></span>
<input class="form-control" name="repeatPassword" #repeatPassword="ngModel"
validateEqualTo="password"
type="password"
required
placeholder="Confirm Password"
[(ngModel)]="user.confirmPassword">
</div>
<button type="button" class="btn btn-block btn-success">Create Account</button>
<button type="button"
[color]="'warn'"
(click)="creatingNewUser(false)">
</button>
<button type="submit"
[color]="'primary'"
[disabled]="!userForm.form.valid">
</button>
</form>
<div *ngIf="!creatingUser">
<button [color]="'primary'" (click)="creatingNewUser(true)">
</button>
</div>
<div class="card-footer p-2">
<div class="row">
<div class="col-6">
<button class="btn btn-block btn-facebook" type="button"><span>facebook</span></button>
</div>
<div class="col-6">
<button class="btn btn-block btn-twitter" type="button"><span>twitter</span></button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>