4

My code is as shown below:

test.html

<div class="q-img-container">
    <img id="q-order-img" src="../img/ic_truck.png" alt=""></img>
</div>

But it gives me following error:

"Unhandled Promise rejection:"
"Template parse errors:
Void elements do not have end tags "img" ("iv class="q-img-container">
                <img id="q-order-img" src="../img/ic_truck.png" alt="">[ERROR ->]</img>
            </div>

My directory structure is as follows:

---app
------img
----------ic_truck.png
------template
----------test.html

What am I missing here?

Aniruddha Das
  • 20,520
  • 23
  • 96
  • 132
Mrugesh
  • 4,381
  • 8
  • 42
  • 84

1 Answers1

6

img tag is a void element. Such elements cannot have any content and are forbidden to be closed (W3C recommendation).

As the error message says, remove the end tag </img>.

Just use following

<img id="q-order-img" src="../img/ic_truck.png" alt="">

Please refer to this answer.

Yogesh
  • 699
  • 1
  • 6
  • 21