Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular2 forms throws Unexpected character "EOF" ("

[note] this question is merely to give aid to other people who google for this error, and I've added my answer myself. I formatted the question poorly, as I didn't want/expect any answers to this. Thought SO would mark my question with a tag or smtn when I ticket the "Answer your own question, Q/A style" -.-

I was messing around with making forms, and I got this error message:

Unexpected character "EOF" ("

Google gave me several results, but none of them were very useful. This issue plagued me for ages.

  <div class="form-group">
    <label for="details">Details</label>
    <textarea formControlName="details" class="form-control" id="details" placeholder="Full details on your report"> <textarea>
  </div>

  <div class="form-group">
    <label for="suggested_solution">Suggested Solution</label>
    <textarea formControlName="suggested_solution" class="form-control" id="suggested_solution" placeholder="Your suggestion for a solution"></textarea>
  </div>

  <div class="form-group">
    <label for="attachments">Relevant attachments</label>
    <input formControlName="attachments" type="file" class="form-control" id="attachments">
  </div>

  <button type="submit" class="btn btn-primary" [disabled]="!form.valid">Submit</button>
</form>
like image 848
yusijs Avatar asked Nov 27 '22 20:11

yusijs


1 Answers

It feels a little weird answering myself, but in case someone else runs into a similar issue, I wanted to share it around! Basically my issue was with the textarea:

<textarea formControlName="details" class="form-control" id="details" placeholder="Full details on your report"> <textarea>

The textarea didn't get closed (I forgot a forward slash on the end). Try finding that from the freakin error message.

Basically, what it looks like to me is that this issue can be caused by numerous problems (I've read about poorly formatted comments akin to <!-- ----> ), but for me it was textareas.

Hopefully someone finds this useful :)

like image 161
yusijs Avatar answered Nov 30 '22 11:11

yusijs