Skip to content
This repository has been archived by the owner on Sep 10, 2019. It is now read-only.

Fix #342 without expanding API #350

Merged
merged 2 commits into from
Dec 21, 2014
Merged

Fix #342 without expanding API #350

merged 2 commits into from
Dec 21, 2014

Conversation

akiran
Copy link
Contributor

@akiran akiran commented Dec 19, 2014

@AntJanus,
when data-src is dynamically updated, angular is updating the src attribute value

So setting data-src value with src value is fixing #342 without introducing new attribute.
I tested the below example with this fix and it is working fine.

<ul ng-init="items=['assets/img/iconic/action.svg', 'assets/img/iconic/ban.svg', 'assets/img/iconic/bell.svg']">
  <li ng-repeat="item in items" >
  <img zf-iconic="" data-src={{item}} class="iconic-sm" >
  </li >
</ul>

@AntJanus
Copy link
Contributor

@akiran I don't understand. You're using the src attribute to be applied to data-src but in your example you're only using data-src.

Either way, I think it'd make sense to have a dyn-src that you can send a variable to without having to use {{ }} inside an attribute (something I'm not a fan of). But to make sure we can cover as many developers as possible, I'd like to have both.

Can you change the file to not delete the dyn-src but keep your fix as well?

@akiran
Copy link
Contributor Author

akiran commented Dec 20, 2014

If we pass an expression to data-src, angular evaluates it and pass its value to src (Similar to ng-src).

Developers can pass a path or path expression to data-src with this fix.

<img zf-iconic="" data-src="iconic/thumb.svg " class="iconic-sm" >
<img zf-iconic="" data-src="iconic/{{name}}.svg"  class="iconic-sm" >

Angular evaluates data-src and pass it to src.
In the directive, src value is again set to data-src because iconic.js uses the value on data-src attribute.

@akiran
Copy link
Contributor Author

akiran commented Dec 20, 2014

Added back dynSrc option

AntJanus added a commit that referenced this pull request Dec 21, 2014
@AntJanus AntJanus merged commit 6f5e659 into zurb:master Dec 21, 2014
@akiran akiran deleted the fix-342 branch December 21, 2014 03:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants