Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. app.directive('dpGrid',()=>{
  2. return{
  3. restrict:"E",
  4. scope:{
  5. items:"="
  6. }
  7. templateUrl: 'template/dbgrid.directive.html'
  8. }
  9.  
  10. });
  11.  
  12. app.controller('mainCtrl',($scope)=>{
  13.  
  14. $scope.data=[{fname:"david",lname:"orman",age:24,id:"234"}];
  15.  
  16. $scope.update=(id)=>{
  17. console.log("ID :",id);
  18. };
  19.  
  20. });
  21.  
  22. <table class="table">
  23. <thead class="thead-inverse">
  24. <tr>
  25. <th>#</th>
  26. <th>fname</th>
  27. <th>lname</th>
  28. <th>age</th>
  29. <th>opt</th>
  30. </tr>
  31. </thead>
  32. <tbody>
  33. <tr ng-repeat="item in items" >
  34. <th>{{$index}}</th>
  35. <td>{{item.fname}}</td>
  36. <td>{{item.lname}}</td>
  37. <td>{{item.age}}</td>
  38. <td><a class="btn btn-danger" ng-click="update(item.id)">update</a></td>
  39.  
  40. </tr>
  41. </tbody>
  42. </table>
  43.  
  44. <dp-grid items="data" ></dp-grid>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement