Advertisement
Guest User

Untitled

a guest
May 27th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. .state('app.contactsTest', {
  2. abstract: true, <<--- If set to true then I get redirected away from the state to the default. If unset then named views don't load
  3. url: '/contactstest',
  4. templateUrl: 'tpl/app.contactsTest.html',
  5. controller: 'ContactTestCtrl',
  6. controllerAs: 'vm',
  7. resolve: {
  8. groups: function () { return {} },
  9. contacts: function () { return {} },
  10. contact: function () { return {} }
  11. }
  12. })
  13. .state('app.contactsTest.subViews', {
  14. views: {
  15. 'groups': {
  16. templateUrl: 'tpl/app.contacts.groups.html'
  17. controller: 'ContactGroupCtrl',
  18. controllerAs: 'groupCtrl',
  19. resolve: {
  20. groups: [ 'ContactGroupSvc', function (ContactGroupSvc) {
  21. ContactGroupSvc.list().success(function (res) {
  22. return res;
  23. });
  24. }]
  25. }
  26. },
  27. 'contacts': {
  28. templateUrl: 'app.contacts.list.html'
  29. resolve: {
  30. contacts: [ 'ContactSvc', function (ContactSvc) {
  31. ContactSvc.list().success(function (res) {
  32. return res;
  33. });
  34. }]
  35. }
  36. },
  37. 'view': {
  38. url: '/{id}',
  39. templateUrl: 'app.contacts.view.html'
  40. resolve: {
  41. contact: [ 'ContactSvc', '$stateParams', function (ContactSvc, $stateParams) {
  42. ContactSvc.get($stateParams.id).success(function (res) {
  43. res.selected = true;
  44. return res;
  45. });
  46. }]
  47. }
  48. },
  49. 'edit': {
  50. url: '/edit/{id}',
  51. templateUrl: 'app.contacts.edit.html'
  52. resolve: {
  53. contact: [ 'ContactSvc', '$stateParams', function (ContactSvc, $stateParams) {
  54. ContactSvc.get($stateParams.id).success(function (res) {
  55. res.selected = true;
  56. res.editing = true;
  57. return res;
  58. });
  59. }]
  60. }
  61. }
  62. }
  63. }
  64.  
  65.  
  66. tpl/app.contactsTest.html
  67.  
  68. <!-- hbox layout -->
  69. <div class="hbox hbox-auto-xs hbox-auto-sm bg-light ">
  70.  
  71. <!-- column -->
  72. <div class="col w-sm b-r" ui-view="groups"></div>
  73. <!-- /column -->
  74.  
  75. <!-- column -->
  76. <div class="col w lter b-r" ui-view="contacts"></div>
  77. <!-- /column -->
  78.  
  79. <!-- column -->
  80. <div class="col bg-white-only" ui-view="view"></div>
  81. <!-- /column -->
  82.  
  83. <!-- column -->
  84. <div class="col bg-white-only" ui-view="edit"></div>
  85. <!-- /column -->
  86. </div>
  87. <!-- /hbox layout -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement