javascript - How to display title with ng-repeat -


<input type="text" ng-model= "name" title="{{name}}">//this title shows name ng-model contains

in same way...

<select title ="{{item.actionid}}" ng-model="item.actionid">  <option ng-repeat="action in actionlist" value="{{action.action_id}}">{{action.url}}</option> </select> 

actionlist:-

$scope.actionlist = [{     "action_id": 39,     "url": "/abc"   }, {     "action_id": 59,     "url": "/xyz"   }]; 

here item parent list. getting title it's id value id. here want corresponding url. how can url.

the json data , code looks fine, check demo below if have missed anything.

demo

var app = angular.module('myapp', []);  app.controller('appctrl', function($scope) {   $scope.actionlist = [{      "action_id": 39,      "url": "/abc"    }, {      "action_id": 59,      "url": "/xyz"    }];  });
<!doctype html>  <html>  <head>   </head>    <body>    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>   <div ng-app="myapp" ng-controller="appctrl">    <div class="form-group">      <select title ="{{item.actionid}}" ng-model="item.actionid">   <option ng-repeat="action in actionlist" value="{{action.action_id}}">{{action.url}}</option>  </select>  </div>   </div>  </body>    </html>


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -