简体   繁体   中英

Angular2 img path

I have problem to insert image in my app:

Currently I have this:

    <div class="col-lg-4 col-md-4 col-sm-6 col-xs-6" routerLinkActive="active">
    <a [routerLink]="['/']">
    <img src="billing.png">Payroll Center
    </a>
    </div>

My image is stored in src/app/images/billing.png

I want to call it from admin.component.html which is stored in: src/app/administration

Presuming you're publishing your image to your dist folder with the same structure as your source, then something like this should work:

<div class="col-lg-4 col-md-4 col-sm-6 col-xs-6" routerLinkActive="active">
    <a [routerLink]="['/']">
        <img src="/app/images/billing.png">Payroll Center
    </a>
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM