Polymer resolvePath for relative resource path -
i try solve resource loading error in vulcanized polymer-app. i’ve read docs method resolvepath
doesn’t seems fix problem. project structure:
test ├── assets │ └── avatar.png ├── components │ └── custom-elem-with-relative-path-to-avatar.html └── index.html
custom-elem-with-relative-path-to-avatar.html
<polymer-element name="aw-account” layout vertical> … <img src="{{avatarimage}}" id="profileavatar" alt="image profile”> … </template> <script> polymer('aw-account', { ready: function () { this.avatarimage = this.resolvepath('../assets/avatar.png'); … </script> </polymer-element>
due ../
image src 1 level above correct folder!
how have use method resolvepath
resource avatar.png loaded correctly in vulcanized-app?
you should use
this.resolvepath('./assets/avatar.png')
in polymer 0.5 or
this.resolveurl('./assets/avatar.png')
in polymer 1.0
Comments
Post a Comment