-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(lib): allow img attributes #111
Conversation
Please rebase your PR on master |
@@ -0,0 +1,12 @@ | |||
class IonicImageLoaderController { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete this file
README.md
Outdated
|
||
2. Generate an array of ImageAttribute objects | ||
```typescript | ||
var imageAttributes: ImageAttribute[] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use const
instead of var
src/components/image-attribute.ts
Outdated
@@ -0,0 +1,4 @@ | |||
export class ImageAttribute { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an interface
src/components/img-loader.ts
Outdated
@@ -185,6 +212,10 @@ export class ImgLoader implements OnInit { | |||
// set it's src | |||
this._renderer.setElementAttribute(this.element, 'src', imageUrl); | |||
|
|||
// if imgAttributes are defined, add them to our img element | |||
this.imgAttributes.forEach((attribute, index, attributeArray) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This should only run if
useImg
is set to true attributeArray
is not needed
Added support to pass through style attributes to the generated tag.
Please feel free to amend / request changes as appropriate - I am primarily a Swift dev and this is my first ionic / typescript PR.