javascript - How can I add separate width to each name and value that are getting iterated by ng-repeat -


how can add separate width each name , value getting iterated by:

ng-repeat in angularjs

for e.g: data:

[ {     "name": "first name",     "value": "harry" }, {     "name": "last name",     "value": "potter" }, {     "name": "gender",     "value": "male" }, {     "name": "dob",     "value": "21/5/1988" }, {     "name": "ssn",     "value": "298456147" }] 

html:

<div>    <div ng-repeat=\ "data in data\">      <div style=\ "float:left\">{{data.name}}</div>      <div style=\ "float:left\">{{data.value}}</div>    </div>  </div>

so, each name , value need separate width.

where can add width properties?

add "track $index" clause described in docs ng-repeat.

ng-repeat="opt in data track $index"

then can use {{opt.name}} , {{opt.value}} , put them in different html elements separate styles.


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -