{"action":"created","issue":{"url":"https://api.github.com/repos/christianalfoni/flux-angular/issues/44","labels_url":"https://api.github.com/repos/christianalfoni/flux-angular/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/christianalfoni/flux-angular/issues/44/comments","events_url":"https://api.github.com/repos/christianalfoni/flux-angular/issues/44/events","html_url":"https://github.com/christianalfoni/flux-angular/issues/44","id":84144490,"number":44,"title":"Any thoughts on integration with Angular 1.4 \"new\" Router?","user":{"login":"5inline","id":1702619,"avatar_url":"https://avatars.githubusercontent.com/u/1702619?v=3","gravatar_id":"","url":"https://api.github.com/users/5inline","html_url":"https://github.com/5inline","followers_url":"https://api.github.com/users/5inline/followers","following_url":"https://api.github.com/users/5inline/following{/other_user}","gists_url":"https://api.github.com/users/5inline/gists{/gist_id}","starred_url":"https://api.github.com/users/5inline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/5inline/subscriptions","organizations_url":"https://api.github.com/users/5inline/orgs","repos_url":"https://api.github.com/users/5inline/repos","events_url":"https://api.github.com/users/5inline/events{/privacy}","received_events_url":"https://api.github.com/users/5inline/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-02T18:33:40Z","updated_at":"2015-06-09T06:36:43Z","closed_at":null,"body":"Seems like the new router observes the \"component\" structure as well, so the $scope doesn't seem to be intended to be accessible.  In short, I can't find a way to make \"$listenTo\" accessible in a controller. \r\n\r\nNew Router:\r\nhttps://github.com/angular/router\r\n\r\n\r\nMy Code:\r\n```\r\nVoteController.$inject = ['widgetStore','flux'];\r\nfunction VoteController (widgetStore, flux)\r\n{\r\n\r\n\t//\r\n\t// Internal\r\n\t// \r\n\tvar _self = this;\r\n\r\n\t// Defaults\r\n\tthis.votes = widgetStore.getVotes();\r\n\r\n\t// Expose Functions\r\n\tthis.submitVote = submitVote;\r\n\r\n\r\n\t//\r\n\t// Events\r\n\t// \r\n\r\n\tthis.$listenTo(widgetStore, 'widget.vote', onVote ); <--- errors out here \r\n\r\n\r\n\t//\r\n\t// Functions\r\n\t// \r\n\r\n\tfunction submitVote ()\r\n\t{\r\n\t\tconsole.log( 'submitVote' );\r\n\r\n\t\tflux.dispatch('submitVote', {});\r\n\t}\r\n\r\n\r\n\tfunction onVote ()\r\n\t{\r\n\t\tconsole.log( 'onVote' );\r\n\t}\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/christianalfoni/flux-angular/issues/comments/110245427","html_url":"https://github.com/christianalfoni/flux-angular/issues/44#issuecomment-110245427","issue_url":"https://api.github.com/repos/christianalfoni/flux-angular/issues/44","id":110245427,"user":{"login":"christianalfoni","id":3956929,"avatar_url":"https://avatars.githubusercontent.com/u/3956929?v=3","gravatar_id":"","url":"https://api.github.com/users/christianalfoni","html_url":"https://github.com/christianalfoni","followers_url":"https://api.github.com/users/christianalfoni/followers","following_url":"https://api.github.com/users/christianalfoni/following{/other_user}","gists_url":"https://api.github.com/users/christianalfoni/gists{/gist_id}","starred_url":"https://api.github.com/users/christianalfoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christianalfoni/subscriptions","organizations_url":"https://api.github.com/users/christianalfoni/orgs","repos_url":"https://api.github.com/users/christianalfoni/repos","events_url":"https://api.github.com/users/christianalfoni/events{/privacy}","received_events_url":"https://api.github.com/users/christianalfoni/received_events","type":"User","site_admin":false},"created_at":"2015-06-09T06:36:43Z","updated_at":"2015-06-09T06:36:43Z","body":"Hi @5inline,\r\n\r\nI believe we researched this a bit with the \"controllFor\" syntax, which I believe does the same thing. We concluded to use $rootScope as listener instead. So:\r\n\r\n```js\r\nVoteController.$inject = ['widgetStore','flux', '$rootScope'];\r\nfunction VoteController (widgetStore, flux, $rootScope)\r\n{\r\n\r\n    //\r\n    // Internal\r\n    // \r\n    var _self = this;\r\n\r\n    // Defaults\r\n    this.votes = widgetStore.getVotes();\r\n\r\n    // Expose Functions\r\n    this.submitVote = submitVote;\r\n\r\n\r\n    //\r\n    // Events\r\n    // \r\n\r\n    $rootScope.$listenTo(widgetStore, 'widget.vote', onVote ); <--- errors out here \r\n\r\n\r\n    //\r\n    // Functions\r\n    // \r\n\r\n    function submitVote ()\r\n    {\r\n        console.log( 'submitVote' );\r\n\r\n        flux.dispatch('submitVote', {});\r\n    }\r\n\r\n\r\n    function onVote ()\r\n    {\r\n        console.log( 'onVote' );\r\n    }\r\n}\r\n```\r\nYou could also hook up the listeners manually, but let me know how this works out first and we can dive a bit more into it :-)"}}