Ionic2 - 在UI上显示项目图像 [英] Ionic2 - Displaying project images on the UI
问题描述
我有以下全新项目,创建时间:
I have the following brand new project, created with:
$ ionic start MyIonic2Project sidemenu --v2
我的问题
非常简单:
-
我在哪里找到
应用程序图像的目录
(资产图像/固定图像/图标/等)?,内部:{resources,src,www等}?我正在寻找最佳做法
。
where do I locate a directory for
application images
(asset images / fixed images / icons / etc)?, inside: {resources, src, www, etc}?. I'm looking forbest practices
.
这些图片的网址如何?我想指定< img src =< url / to / image.jpg> />
文件中的元素: src / pages / home / home.ts
。
how the url of these images would look like?. I wanna specify the <img src="<url/to/image.jpg>" />
element within the file: src/pages/home/home.ts
.
推荐答案
src / assets /
文件夹应包含所有资源。您可以根据资源类型使用任何子文件夹。在构建过程中, src / assets
中的所有内容都将复制到 www / assets
。
src/assets/
folder should contain all the resources. You can use any sub-folder depending on type of resource. During the build process everything in the src/assets
is copied to www/assets
.
这些图片的网址如何?
how the url of these images would look like?
你有当它在www文件夹中时,给出相对于当前文件的路径。
如果你在你的scss文件中设置它通常是 ../ assets /../ filename
。(这最终会成为main.css的一部分)构建文件夹)。你的html文件中有
和 ./ assets /../ filename
。
You have to give the path relative to your current file when it would be in www folder.
It is generally ../assets/../filename
if you are setting in your scss file.(This would end up as part of main.css within build folder).
and ./assets/../filename
in your html file.
这篇关于Ionic2 - 在UI上显示项目图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!