2017-12-29 13 views
0

새로운 HTML 코드를 추가 한 후 4 번 각도에서 오류가 발생합니다. 이전에는 양식이 정상적으로 작동하고있었습니다. 할 것 - - 나는 코드를 새로운하지만 여전히 밤은 작업을 주석 노력이 오류를 연구하고 해결을 시도했지만 아무것도 도움이되지 -도 내가 문제오류 : 참조 또는 변수에 할당 할 수 없습니다! Angular 4

내 코드의 정확한 위치는 무엇입니까 :

<form role="form" #adminForm="ngForm" (ngSubmit)="logAdmin(adminForm.form)"> 
      <div class="form-group"> 
      <input class="form-control" [(ngModel)]="adminUsername" #adminUsername="ngModel" placeholder="Username" type="text" name="adminUsername" 
       required> 
      <div *ngIf="adminUsername.touched && adminUsername.errors"> 
       <div class="alert alert-danger" *ngIf="adminUsername.errors.required">Username is required</div> 
      </div> 
      </div> 
      <div class="form-group"> 
      <input class="form-control" [(ngModel)]="passwordText" #adminPassword="ngModel" id="adminPassword" name="adminPassword" placeholder="Password" 
       type="password" required> 
      </div> 
      <div class="alert alert-danger" *ngIf="adminPassword.touched && adminPassword.errors">Password is required</div> 
      <div class="col-md-6" style="text-align: right"> 
      <button type="submit" class="btn-yellow" [disabled]="!adminForm.valid">Log In</button> 
      </div> 
     </form> 
을 내가 얻고

오류 :

Error: Cannot assign to a reference or variable! 
    at _AstToIrVisitor.visitPropertyWrite (webpack-internal:///../../../compiler/esm5/compiler.js:26550:23) 
    at PropertyWrite.visit (webpack-internal:///../../../compiler/esm5/compiler.js:4895:24) 
    at convertActionBinding (webpack-internal:///../../../compiler/esm5/compiler.js:26000:45) 
    at eval (webpack-internal:///../../../compiler/esm5/compiler.js:28519:22) 
    at Array.forEach (<anonymous>) 
    at ViewBuilder._createElementHandleEventFn (webpack-internal:///../../../compiler/esm5/compiler.js:28515:18) 
    at nodes.(anonymous function) (webpack-internal:///../../../compiler/esm5/compiler.js:27934:27) 
    at eval (webpack-internal:///../../../compiler/esm5/compiler.js:28460:22) 
    at Array.map (<anonymous>) 
    at ViewBuilder._createNodeExpressions (webpack-internal:///../../../compiler/esm5/compiler.js:28459:56) 
    at _AstToIrVisitor.visitPropertyWrite (webpack-internal:///../../../compiler/esm5/compiler.js:26550:23) 
    at PropertyWrite.visit (webpack-internal:///../../../compiler/esm5/compiler.js:4895:24) 
    at convertActionBinding (webpack-internal:///../../../compiler/esm5/compiler.js:26000:45) 
    at eval (webpack-internal:///../../../compiler/esm5/compiler.js:28519:22) 
    at Array.forEach (<anonymous>) 
    at ViewBuilder._createElementHandleEventFn (webpack-internal:///../../../compiler/esm5/compiler.js:28515:18) 
    at nodes.(anonymous function) (webpack-internal:///../../../compiler/esm5/compiler.js:27934:27) 
    at eval (webpack-internal:///../../../compiler/esm5/compiler.js:28460:22) 
    at Array.map (<anonymous>) 
    at ViewBuilder._createNodeExpressions (webpack-internal:///../../../compiler/esm5/compiler.js:28459:56) 
    at resolvePromise (webpack-internal:///../../../../zone.js/dist/zone.js:824:31) 
    at resolvePromise (webpack-internal:///../../../../zone.js/dist/zone.js:795:17) 
    at eval (webpack-internal:///../../../../zone.js/dist/zone.js:873:17) 
    at ZoneDelegate.invokeTask (webpack-internal:///../../../../zone.js/dist/zone.js:425:31) 
    at Object.onInvokeTask (webpack-internal:///../../../core/esm5/core.js:4944:33) 
    at ZoneDelegate.invokeTask (webpack-internal:///../../../../zone.js/dist/zone.js:424:36) 
    at Zone.runTask (webpack-internal:///../../../../zone.js/dist/zone.js:192:47) 
    at drainMicroTaskQueue (webpack-internal:///../../../../zone.js/dist/zone.js:602:35) 
    at <anonymous> 

내가 인터넷에서 검색하여 질문에 동일한 오류 & 답을 찾을 수 -하지만 난 나를 위해 일한 모든 솔루션을 가지고 didnt한다 ... 그게이 오류가 반복하지만 할 이유 대답은 보인다. 다른 많은 사람들이 거기에있다.

+0

Q & A는 환영하지만, 먼저 검색 확인하는 나를 위해 일한 솔루션, 기타가 정확히 동일한 ngModel 변수 이름을 개명 한 것입니다 이것에 대한 질의 응답) – Alex

답변

5

문제는 내가

[(ngModel)]="adminUsername" #adminUsername="ngModel" 

[(ngModel)]="adminUsernameText" #adminUsername="ngModel"