{"action":"created","issue":{"url":"https://api.github.com/repos/angular-ui/ui-router/issues/494","labels_url":"https://api.github.com/repos/angular-ui/ui-router/issues/494/labels{/name}","comments_url":"https://api.github.com/repos/angular-ui/ui-router/issues/494/comments","events_url":"https://api.github.com/repos/angular-ui/ui-router/issues/494/events","html_url":"https://github.com/angular-ui/ui-router/issues/494","id":20839370,"number":494,"title":"Use the same controller for all views in multi-views states","user":{"login":"Neozaru","id":1905292,"avatar_url":"https://avatars.githubusercontent.com/u/1905292?v=3","gravatar_id":"","url":"https://api.github.com/users/Neozaru","html_url":"https://github.com/Neozaru","followers_url":"https://api.github.com/users/Neozaru/followers","following_url":"https://api.github.com/users/Neozaru/following{/other_user}","gists_url":"https://api.github.com/users/Neozaru/gists{/gist_id}","starred_url":"https://api.github.com/users/Neozaru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Neozaru/subscriptions","organizations_url":"https://api.github.com/users/Neozaru/orgs","repos_url":"https://api.github.com/users/Neozaru/repos","events_url":"https://api.github.com/users/Neozaru/events{/privacy}","received_events_url":"https://api.github.com/users/Neozaru/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2013-10-10T22:17:34Z","updated_at":"2015-05-29T10:37:04Z","closed_at":"2013-12-04T16:04:00Z","body":"Given this example from Wiki, when using multiple views in one state, user have to specify a controller for each view\r\n```\r\n$stateProvider\r\n  .state('report',{\r\n    views: {\r\n      'filters': {\r\n        templateUrl: 'report-filters.html',\r\n        controller: function($scope){ ... controller stuff just for filters view ... }\r\n      },\r\n      'tabledata': {\r\n        templateUrl: 'report-table.html',\r\n        controller: function($scope){ ... controller stuff just for tabledata view ... }\r\n      },\r\n      'graph': {\r\n        templateUrl: 'report-graph.html',\r\n        controller: function($scope){ ... controller stuff just for graph view ... }\r\n      },\r\n    }\r\n  })\r\n```\r\n\r\nIn my own case (I think I'm not alone), for some states, I use the same controller for all my views (example: I have a view for the Left Panel, Top Panel, etc, and sometimes each of these views have to access to the same context).\r\n\r\nIt would be good to add a parameter in states allowing to add a common controller for all views of this state.\r\n\r\nSample of my code\r\n```\r\n        .state('project' , {\r\n            url: '/projects/{project_id:[0-9]+}',\r\n            views: {\r\n              \"page\": { templateUrl: PAGES_PARTIALS_FOLDER + 'project.html' },\r\n              \"leftMenu\":  { templateUrl: LEFT_MENU_PARTIALS_FOLDER + 'project.html' },\r\n              \"rightMenu\": { templateUrl: RIGHT_MENU_PARTIALS_FOLDER + 'project.html' }\r\n            },\r\n            controller: 'projectCtrl' // Doesn't work, I have to define a controller per view\r\n        })\r\n```"},"comment":{"url":"https://api.github.com/repos/angular-ui/ui-router/issues/comments/106768851","html_url":"https://github.com/angular-ui/ui-router/issues/494#issuecomment-106768851","issue_url":"https://api.github.com/repos/angular-ui/ui-router/issues/494","id":106768851,"user":{"login":"asaarnak","id":808420,"avatar_url":"https://avatars.githubusercontent.com/u/808420?v=3","gravatar_id":"","url":"https://api.github.com/users/asaarnak","html_url":"https://github.com/asaarnak","followers_url":"https://api.github.com/users/asaarnak/followers","following_url":"https://api.github.com/users/asaarnak/following{/other_user}","gists_url":"https://api.github.com/users/asaarnak/gists{/gist_id}","starred_url":"https://api.github.com/users/asaarnak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asaarnak/subscriptions","organizations_url":"https://api.github.com/users/asaarnak/orgs","repos_url":"https://api.github.com/users/asaarnak/repos","events_url":"https://api.github.com/users/asaarnak/events{/privacy}","received_events_url":"https://api.github.com/users/asaarnak/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T10:37:04Z","updated_at":"2015-05-29T10:37:04Z","body":"+1"}}