Hi I have some fields which are coming dynamic and I am adjusting the col-md- according to number of fields. So I wrote an expression some thing like this <div class="col-md-{{12 / variants.length}} Now I want to round off the value. How can I do this ?
How can I round off value in dynamic col-md-(value) in Angular Js?
184 Views Asked by Usman Iqbal At
2
There are 2 best solutions below
0
T.Gounelle
On
You can use a function defined in the controller, e.g.
<div class="col-md-{{colWidth(variants.length)}}">something</div>
In the controller:
$scope.colWidth = function(nbVariants) {
// Use whatever formula suits your needs. Be aware that this may return 0
return Math.round(12/nbVariants);
}
Related Questions in ANGULARJS
- Angular Show All When No Filter Is Supplied
- Using pagination on a table in AngularJS
- State with different subviews
- Getting and passing MVC Model data to AngularJS controller
- Implementing prerender.io middleware in sails.js
- Token based authorization in nodejs/ExpressJs and Angular(Single Page Application)
- AngularJS, Google App Engine and URLrewrite
- send data from table to another page into forms
- How to write tests for classes with inheritance
- angularJS sending OPTIONS instead of POST
- Receiving POST from external application in AngularJS
- Metaprogramming AngularJS Filters
- Reload List after Closing Modal
- Why is my angularjs site not completely crawlable?
- Why is separation of JavaScript and HTML a good practice?
Related Questions in TWITTER-BOOTSTRAP
- UIWebView Screen Fitting Issue
- Website zoomed out on Android default browser
- Twitter Bootstrap horizontal form elements on a line
- My navbar is not expanding after collapse
- Reload List after Closing Modal
- Overwrite Bootstrap style for a single page
- UI.Bootstrap Angular Typeahead and Firebase Array
- Bootstrap - Fixed navbar doesn't do what's expected?
- Bootstrap NavBar with no content on small screens
- Bootstrap Dropdown Button Problems
- ScrollBar not showing up - BootStrap
- Bootstrap flip card with css3 transform
- bootstrap grid layout questions
- How do I make jquery events work in a bootstrap modal with dynamic content and selectors?
- Using GLYPHICONS's free pngs with classes
Related Questions in DYNAMIC
- Convert Apache VirtualHost to nginx Server Block for Dynamic Subdomains
- Nested dynamically generated forms using jQuery
- AngularJS Dynamic Slider Control
- dynamic content control mapping for MS word c#
- get value from the dynamic create textbox
- Android : Unable to change width of dynamic button
- saving matlab file (.mat) with dynamic name
- MODx Create dynamic frontend page / display manager page without login
- Dynamic XML parsing, data storage, and forms in c#
- Cannot convert type 'Umbraco.Core.Dynamics.DynamicNull' to 'Umbraco.....' - Umbraco v6
- IDynamicMetaObjectProvider set property using literal name
- PHP unable to load dynamic library
- How to use Dynamic Variables?
- How can call method dynamically in c#
- Make divs inside table cells the same height without javascript
Related Questions in CEIL
- search the column with decimal value for '.'
- How can I round off value in dynamic col-md-(value) in Angular Js?
- PHP - round() function with PHP_ROUND_HALF_DOWN mode (unexpected behavoir)
- MySQL - Rounding (sort of) - Want to round number only if greater than/less than 10
- math.ceil returns float (1.5)
- How can I make sure a float will always be rounded up with PHP?
- DecimalFormat not ceiling properly
- Why floor and ceil functions giving different values when applied on a log function result in c++
- How to round decimals in PHP to match Google's results
- Floor or ceiling of a pandas series in python?
- How can I move datetime to the closest five minutes?
- With PHP, how to check if decimal number is above or less than 50?
- PHP ceil gives wrong results if input is a float with no decimal
- Can I trust a real-to-int conversion of the result of ceil()?
- how to perform oracle ceil with decimal points
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
In your controller maybe try rounding there instead of on the HTML side?