-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Feature: Separator for ng-repeat tags. #12769
Comments
@Masterovoi why you don't use
and you will get
? |
In your example AngularJS not used separator - space character - ASCII 32! |
@Masterovoi you can use
or
I think this will print a white space between each span except the last one |
I'm sorry, but you will not understand the question. I need a space between adjacent tags span.
|
Really needing a space between spans and not at the end of span means that you depend of "something" in your css that you could probably change to solve your problem. |
Since there are so many ways to achieve this result already, I'm not in favor of adding a separator. In fact, you can even achieve this with pure CSS: http://cssdeck.com/labs/ppqsob8n |
@Narretz: Indeed. You're right and it's better to keep Angular concise and effective. |
@Narretz: If for example add a snippet,
then there will be no separator "buttons" |
Look at the problem from your first and second examples ("here is the problem with the HTML-wrap"): The third example - this is my version of what I need to get from the ng-repeat. |
I see what you mean. After elements are not good enough in this case. Still, I don't see using actual spaces to separate tags as such a good (and frequent) idea. For example, html minifiers actually remove these spaces to create smaller payloads. And I still think that CSS should be used for this, see here for example: http://jsbin.com/mofukofoxi/edit?html,css,output |
Sequence breaks CSS: "float"
|
Ah, you are making this very hard! :) What do you mean by
I assume you mean they won't be able to separate spans if they are meant to be individual units. I don't know if that is the case. I've never heard of of being a problem. |
:) Hard - is to use CSS (for spaces into text), where it is not needed. More than 20 years, I aim to write the shortest HTML. |
@Masterovoi is it possible to give some additional context on the problem you're trying to solve and why the spaces are relevant and cannot be solved by CSS? |
Elements with space between them render different than elements w/o space between them. This is normal if you think about the fact we are writing into a document. The ask is to use ng-repeat to create elements that have a space between them so they render properly in the document. You can add space (margin) with CSS but it feels hack-ish, because the markup should/would take care of this. Which I think is why there is a want to add a feature to ng-repeat so that it can generate the markup to allow this natural feature to work. As an example if I have a set of elements I want to put into the flow of a document using ng-repeat I need to modify the way they render rather than use proper markup to make them render. Something like this may sort of work, but the actual spacing between elements seems to be depending on more than just 1em. html
less
|
After playing with this the cleanest way is to create more markup and let the browser render it out. In order to make CSS work you will need to add extra markup anyway soooooo you may as well let the browser do what it does naturally and not try and fix it w/ CSS. don't do this:
do this:
|
You can workaround this problem by using margins and whatnot, but it's not an actual solution. Also, minifiers don't remove the spaces between elements, because of the very reason that spaces have meaning. They only remove extra whitespace characters (tab, newline, space...), just like HTML does. 5 spaces in the source HTML will render as a single space (and the whitespace is explicitly visible in Firefox devtools). So honestly, the ng-repeat seems poorly thought out. |
Hello developers AngularJS!
I need to get HTML (SPAN separated is a space):
I found how to solve the problem:
But it is very inconvenient.
I need an extra tag separator for ng-repeat, for example, ng-separator.
For examples HTML:
Help me please
The text was updated successfully, but these errors were encountered: