Untitled


SUBMITTED BY: antoineh1

DATE: May 4, 2016, 6:02 p.m.

FORMAT: Text only

SIZE: 2.7 kB

HITS: 733

  1. var rooms = [
  2. {
  3. name: 'Room 1',
  4. position: {x: 0, y: 0},
  5. size: {x: 2, y: 1}
  6. },
  7. {
  8. name: 'Room 2',
  9. position: {x: 2, y: 0},
  10. size: {x: 2, y: 1}
  11. },
  12. {
  13. name: 'Room 3',
  14. position: {x: 0, y: 1},
  15. size: {x: 1, y: 2}
  16. },
  17. {
  18. name: 'Room 4',
  19. position: {x: 3, y: 1},
  20. size: {x: 1, y: 2}
  21. }
  22. ]
  23. +-------------------+-------------------+
  24. | | |
  25. | | |
  26. | Room 1 | Room 2 |
  27. +---------+---------+---------+---------+
  28. | | | |
  29. | | | |
  30. | | | |
  31. | | | |
  32. | | | |
  33. | Room 3 | | Room 4 |
  34. +---------+ +---------+
  35. <html>
  36. <head>
  37. <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.7/angular-material.min.css" />
  38. <style>
  39. .red {
  40. background: #ff8a80; }
  41. </style>
  42. </head>
  43. <body ng-app="app" ng-controller="roomController as ctrl">
  44. <md-grid-list md-cols="5" md-row-height="4:3" md-gutter="12px">
  45. <md-grid-tile ng-repeat="room in ctrl.rooms" md-colspan="{{room.size.x}}" md-rowspan="{{room.size.y}}" class="red">{{room.name}}
  46. </md-grid-tile>
  47. </md-grid-list>
  48. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js "></script>
  49. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.min.js "></script>
  50. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-aria.min.js "></script>
  51. <script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.7/angular-material.min.js "></script>
  52. <script>
  53. angular.module("app",["ngMaterial"]).controller("roomController",roomController)
  54. function roomController() {
  55. var vm = this
  56. vm.rooms = [
  57. {
  58. name: 'Room 1',
  59. position: {x: 0, y: 0},
  60. size: {x: 2, y: 1}
  61. },
  62. {
  63. name: 'Room 2',
  64. position: {x: 2, y: 0},
  65. size: {x: 2, y: 1}
  66. },
  67. {
  68. name: 'Room 3',
  69. position: {x: 0, y: 1},
  70. size: {x: 1, y: 2}
  71. },
  72. {
  73. name: 'Room 4',
  74. position: {x: 3, y: 1},
  75. size: {x: 1, y: 2}
  76. }
  77. ]
  78. return
  79. }
  80. </script>
  81. </body>
  82. </html>

comments powered by Disqus