Skip to content
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

Better iteration plugin #4

Open
anthonyshort opened this issue Mar 10, 2014 · 6 comments
Open

Better iteration plugin #4

anthonyshort opened this issue Mar 10, 2014 · 6 comments

Comments

@anthonyshort
Copy link
Contributor

The current each plugin was hacked together quickly. It's pretty gross.

@anthonyshort
Copy link
Contributor Author

The current plugin is really only useful when the item themselves aren't views since changes to the values don't re-render the DOM.

We need something that can handle an array of views specifically and watches the array for changes. It would probably be a different plugin.

@uipoet
Copy link

uipoet commented May 9, 2014

A possibly related bug: <img src={{imageSource}}/> in the template being iterated causes a console.error when first initializing:

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/{{imageSource}}

@wryk
Copy link

wryk commented May 9, 2014

@uipoet It's a normal behaviour, when your browser process <img src={{imageSource}}/> he make a http request to http://localhost/{{imageSource}} and the server responds with an appropriate 404 status.

Better explanation : https://docs.angularjs.org/api/ng/directive/ngSrc

@uipoet
Copy link

uipoet commented May 9, 2014

@wryk Thank you for the prompt and helpful solution!

@anthonyshort
Copy link
Contributor Author

Yeah you could make a directive that gets around it easily:

View.directive('data-src', function(value, el){
   el.src = value;
});

Might be worth me just including this in the library since it's tiny.

@uipoet
Copy link

uipoet commented May 9, 2014

Not a bad idea to bake it in. In my case, I've already made a component for photographs that now does this. I think the minimum to do would be update the README.md for the each plugin with this as the example. The current example led me to believe there was a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants