Xavier
Xavier

Reputation: 4015

Angular2 - How to reference an image in the template

I have this structure:

enter image description here

And I want to reference "logo.svg" in my component. Like this:

@Component(
    selector: 'my-app',
    template: '<img src="logo.svg">')
class AppComponent {}

What should I put in the src attribute to reference the logo correctly? Is there a specific scheme to use?

Upvotes: 4

Views: 1080

Answers (1)

illnr
illnr

Reputation: 800

For Angular 5.0.0 you can reference it like this:

@Component(
    selector: 'my-app',
    template: '<img src="packages/angular_app/logo.svg">')
class AppComponent {}

Replace angular_app with the name defined in your pubspec.yaml.

Upvotes: 1

Related Questions