javascript - AngularJS ng-repeat overflow -


i'm trying output html anchors inside fixed width container. when using angular's ng-repeat links overflow outside of container. below code snippet ng-repeat. refer jsfiddle example of overflow.

http://jsfiddle.net/n1lkybwf/2/

<div style="width: 200px; padding: 5px; border: solid 3px #000;">     <a ng-repeat="tag in tags" style="margin-right: 5px;">{{tag}}</a> </div> 

the problem width of container being calculated before dom rendered (dom rendering asynchronous). in angular, order things happening...

by default, anchor tag displays inline-block while simple div block. that's why solution ng-repeat div not anchor tag, fix block-displaying styling div display: inline-block.

  <div class="tag" ng-repeat="tag in tags" style="display:inline-block;">     <a  style="margin-right: 5px;">{{tag}}</a>   </div> 

here working fiddle : http://jsfiddle.net/9zhc3bqu/


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -