I would like to view list of strings in default-label format of bootstrap with angular-js ng-repeat
Following is a code snippet,
<div class="row">
<div class="col-md-12">
<span ng-repeat="hobby in hobbies" class="label label-default col-md-2">{{hobby.name}}</span>
</div>
</div>
Output of above does not looks good. default label fills col-md-2 and also if list is big then it goes out of row div.
I would like to have output as following
How can I acheive following with default-label from bootstrap classes?
And I would like to use only classes/styles provided by bootstrap and NOT custom css.
You dont need the col-md-2 class on the span element:
<div class="row">
<div class="col-md-12">
<span ng-repeat="hobby in hobbies" class="label label-default">{{hobby.name}}</span>
</div>
</div>
You can read up more on the label variations on the bootstrap website
A note from the bootstrap website:
Have tons of labels? Rendering problems can arise when you have dozens
of inline labels within a narrow container, each containing its own
inline-block element (like an icon). The way around this is setting
display: inline-block;. For context and an example, see #13219.
UPDATE
If you are using the ng-repeat directive directly on a label label- you might end up with labels that do not have spacing between the labels. This is related to this question and this question
You might end up with labels looking like this:
I have created a jsfiddle to show the two results, you might need to update your HTML to fix the spacing issue.
You can use the following HTML to resolve the issue if you do not want to add a custom class with margin:
<div class="row">
<div class="col-sm-12">
<span ng-repeat="label in labels">
<span class="label label-default">{{label}}</span>
</span>
</div>
</div>
The result:
Answer by Tjaart van der Walt looks perfect.I also did work around and found following answer,
<div class="row">
<ul class="list-inline col-md-6">
<li ng-repeat="hobby in hobbies">
<span class="label label-default">{{hobby.name}}</span>
</li>
</ul>
</div>
Related
I am having the following issue: I am trying to space each of the values underneath each of the title header (see image) in Bootstrap 4. They are currently set up as tags because we are inside of an accordion. I tried the following approach, but that did not work:
<span style="width: pecentagenumber%">NUMBER</span>
How can I do this?
My current code:
<div id="accordion>
<h3>
<span>#bill.MonthName, #bill.Year</span>
<span>#bill.PackageCount</span>
<span>Tier #bill.Tier</span>
<span>$#bill.TotalPrice</span>
<span>UNPAID</span>
</h3>
</div>
This is how it looks currently.
If you have a flexible ability to edit you HTML - lets use bootstrap 4 row and cols structure.
<div id="accordion" class="container">
<h3 class="row">
<span class="col">#bill.MonthName, #bill.Year</span>
<span class="col">#bill.PackageCount</span>
<span class="col">Tier #bill.Tier</span>
<span class="col">$#bill.TotalPrice</span>
<span class="col">UNPAID</span>
</h3>
</div>
This way you will get 5 cols with the same width. It's better to use div instead h3 and span, but I tried adapt it to your request.
More about BS4 Grid system
I'm currently building an application for a Pomodoro Timer, I'm using Bulma as a CSS Framework, and so far I'm loving it, I'm still learning how Flexbox works, I would like to know what would be the best approach to this situation and if it can be done using only Bulma classes or if I would have to create my own.
I'm trying to create "cards" for each task added, but I want them to be just about half or less that the full screen width. I don't understand how to make this happen using Bulma, since everything just takes the full width and I can't just center everything since it doesn't have a hard-coded width. This is my code for the section that contains the task cards.
<div class="section">
<div class="task-container is-center">
<div class="card is-clearfix is-1-touch" style="margin-bottom: 10px" v-for="task in tasks" :key="task.id">
<input type="checkbox" class="checkbox">
<span class="has-text-left">
{{task.desc}}
</span>
<span class="icon is-pulled-right has-text-danger"><i class="far fa-times-circle"></i></span>
<span class="icon is-pulled-right has-text-primary"><i class="far fa-play-circle"></i></span>
</div>
</div>
</div>
Any help, tips, suggestions, etc. Would be greatly appreciated!.
You could use columns classes to achieve what you want
<div class="task-container columns is-multiline">
<div class="card column is-half is-offset-one-quarter">
// statements
</div>
</div>
Here is the link to the official documentation: https://bulma.io/documentation/columns/options/#centering-columns
You could wrap the card div with a columns container and use the is-half class if you don't want to use the offset class.
Using IMPORTXML, how can I pull out the values "237" (span class="flirblue") and "99" (span class="cents") from the following HTML?
<div class="row visible-xs text-center mobile-price-panel" style="margin-bottom: 10px;">
<div class="col-xs-12" style="padding: 7px 0px;">
<div class="col-xs-6"><span class="pricing">€</span><span class="flirblue">237,</span><span class="cents">99</span> </div>
<div class="col-xs-6"><a class="btn btn-primary main-buy-button btn-group-justified page-scroll" href="#models">VORBESTELLEN</a> </div>
</div>
</div>
I have only just started fiddling with IMPORTXML, and have gotten a number of them to work perfectly on several different websites, but I just cannot find a way to get the 237 and the 99 off one particular site, of which the above is an example of the HTML.
My last attempt on the above was:
=ImportXML("URL","//div[#class='row visible-xs text-center mobile-price-panel']//div[#class='col-xs-12']//div[#class='col-xs-6']//span[#class='flirblue']")
But it does not work, and no matter how I fiddle.
Please help.
Kind regards
Padster
Name directly the class you want.
Example for Flirblue:
=ImportXML("URL","//div[#class='flirblue']")
Some minor tweaking required, but should work.
I want to create an accordion with nested levels. So I have used Angular's accordion directive to create nested levels. But the last level contains a list which should get displayed one by one on new line. But what happens in my case all sub categories gets listed in one line.
I saw in the console that all sub categories are getting listed in one panel body. They should get separate class for each of the sub categories. Any one know how to do that? This is code of my accordion:
<div style='padding-top:50px;'>
<accordion>
<accordion-group heading="Title">
<accordion close-others="oneAtATime">
<accordion-group heading="Category">
<span>Subcat1</span>
<span>Subcat2</span>
</accordion-group>
</accordion>
</accordion-group>
</accordion>
</div>
Directive accordion-group is replacing following code:
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a href class="accordion-toggle" ng-click="toggleOpen()" accordion-transclude="heading">
<span ng-class="{\'text-muted\': isDisabled}">{{heading}}</span>
</a>
</h4>
</div>
<div class="panel-collapse" collapse="!isOpen">
<div class="panel-body" ng-transclude>
</div>
</div>
</div>
So whatever I am printing inside <accordion-group></accordion-group> is getting placed in div having class panel-body. But as I am printing Subcat1 and Subcat2 inside accordion-group is going in one div panel-body. Like this:
<div ng-transclude="" class="panel-body">
<span class="ng-scope">Subcat1</span>
<span class="ng-scope">Subcat2</span>
</div>
But I want separate panel-body div for each of Subcat. Like
<div class="panel-body"><span>Subcat1</span></div>
<div class="panel-body"><span>Subcat1</span></div>
For more details see this plunker
Sorry for my english..:P
A <span> is defined as an inline element and will on its own not introduce any line breaks.
To achieve the output on multiple lines, you would either want to use elements that do that on their own, or make use of custom styles, usually via CSS.
If you really have a list of subcategories, you could for example use an ordered list <ol>.
Simple example:
<accordion>
<accordion-group heading="Title">
<accordion close-others="oneAtATime">
<accordion-group heading="Category">
<ol>
<li>Subcat1</li>
<li>Subcat2</li>
</ol>
</accordion-group>
</accordion>
</accordion-group>
Updated Plunker: Link
But this has nothing to do with your tags angularjs or the angular-ui accordion, it's an issue of plain HTML.
Using font icons I put
<div data-icon="r"> </div>
to have an icon display for example.
Now if I like two or more of the same icon to display next to the first one can I only use multiple divs for that like so
<div data-icon="r"> </div>
<div data-icon="r"> </div>
<div data-icon="r"> </div>
or can one somehow write
<div data-icon="r" "r" "r"> </div>
or
<div data-icon="r,r,r,r"> </div>
or something along those lines?
Naturally all these tests fails so I wonder if this is generally possible in HTML and if so how please?
How about this?
<div>
<i data-icon="r"></i>
<i data-icon="r"></i>
<i data-icon="r"></i>
<i data-icon="r"></i>
</div>
This should create 4 inline icons. Im basing this on how font awesome works.