Skip to content

linking an image from template html requires path from app root #3292

Closed
@entzik

Description

@entzik

OS?

OSX El Capitan

Versions.

angular-cli: 1.0.0-beta.21
node: 6.2.2
os: darwin x64

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

  • create a component under app, say AppHeaderComponent.

  • in the component directory - app-header - create an 'images' directory.

  • put an image in that directory, say 'company-logo.png'.

  • in the template link the image as '<img src="images/company-logo.png">'. now serve the application

  • serve the app using ng-serve

=> this used to be possible when building with 1.0.0-beta16, the image would show up as expected. when building with 1.0.0.beta21 the image is not found. for it to work, I need to specify the full path from root: "<img src="app/header-panel/images/company-logo.png">. This is annoying because if I decide to refactor the project by renaming the components or moving it deeper in the hierarchy I need to also refactor all the templates. Being able to specify a relative path relative to the template is a big advantage. Also I need to publish this "app-header" as a reusable component, the image belongs next to the template.

The log given by the failure.

no specific log

Thanks! We'll be in touch soon.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions