{"action":"created","issue":{"url":"https://api.github.com/repos/marilynpi/jbsrur/issues/1","repository_url":"https://api.github.com/repos/marilynpi/jbsrur","labels_url":"https://api.github.com/repos/marilynpi/jbsrur/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/marilynpi/jbsrur/issues/1/comments","events_url":"https://api.github.com/repos/marilynpi/jbsrur/issues/1/events","html_url":"https://github.com/marilynpi/jbsrur/issues/1","id":173482247,"number":1,"title":"tokko.controller it is instantiated twice","user":{"login":"nercof","id":10401452,"avatar_url":"https://avatars.githubusercontent.com/u/10401452?v=3","gravatar_id":"","url":"https://api.github.com/users/nercof","html_url":"https://github.com/nercof","followers_url":"https://api.github.com/users/nercof/followers","following_url":"https://api.github.com/users/nercof/following{/other_user}","gists_url":"https://api.github.com/users/nercof/gists{/gist_id}","starred_url":"https://api.github.com/users/nercof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nercof/subscriptions","organizations_url":"https://api.github.com/users/nercof/orgs","repos_url":"https://api.github.com/users/nercof/repos","events_url":"https://api.github.com/users/nercof/events{/privacy}","received_events_url":"https://api.github.com/users/nercof/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/marilynpi/jbsrur/labels/bug","name":"bug","color":"ee0701"}],"state":"open","locked":false,"assignee":{"login":"nercof","id":10401452,"avatar_url":"https://avatars.githubusercontent.com/u/10401452?v=3","gravatar_id":"","url":"https://api.github.com/users/nercof","html_url":"https://github.com/nercof","followers_url":"https://api.github.com/users/nercof/followers","following_url":"https://api.github.com/users/nercof/following{/other_user}","gists_url":"https://api.github.com/users/nercof/gists{/gist_id}","starred_url":"https://api.github.com/users/nercof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nercof/subscriptions","organizations_url":"https://api.github.com/users/nercof/orgs","repos_url":"https://api.github.com/users/nercof/repos","events_url":"https://api.github.com/users/nercof/events{/privacy}","received_events_url":"https://api.github.com/users/nercof/received_events","type":"User","site_admin":false},"assignees":[{"login":"nercof","id":10401452,"avatar_url":"https://avatars.githubusercontent.com/u/10401452?v=3","gravatar_id":"","url":"https://api.github.com/users/nercof","html_url":"https://github.com/nercof","followers_url":"https://api.github.com/users/nercof/followers","following_url":"https://api.github.com/users/nercof/following{/other_user}","gists_url":"https://api.github.com/users/nercof/gists{/gist_id}","starred_url":"https://api.github.com/users/nercof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nercof/subscriptions","organizations_url":"https://api.github.com/users/nercof/orgs","repos_url":"https://api.github.com/users/nercof/repos","events_url":"https://api.github.com/users/nercof/events{/privacy}","received_events_url":"https://api.github.com/users/nercof/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-08-26T15:38:08Z","updated_at":"2016-08-26T19:16:33Z","closed_at":null,"body":"Cuando se invoca a /tokko tokko.controller se invoca dos veces.\r\nSalida por consola:\r\n\r\n`JQMIGRATE: Migrate is installed, version 1.4.1`\r\n`Load app ...app.js`\r\n`Modules:  ui.router underscore app.routes ngResource app.core app.services app.factories ngMap`\r\n`Load app.routes.js`\r\n`Load tokko.service.js`\r\n`Load tokko.factory.js`\r\n`Load barrios x zona`\r\n`Load tokko.controller.js`\r\n`Resource {$promise: d, $resolved: false}`\r\n`Resource {$promise: d, $resolved: false}`\r\n`Load tokko.controller.js`\r\n`Resource {$promise: d, $resolved: false}`\r\n`Resource {$promise: d, $resolved: false}`\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/marilynpi/jbsrur/issues/comments/242826551","html_url":"https://github.com/marilynpi/jbsrur/issues/1#issuecomment-242826551","issue_url":"https://api.github.com/repos/marilynpi/jbsrur/issues/1","id":242826551,"user":{"login":"nercof","id":10401452,"avatar_url":"https://avatars.githubusercontent.com/u/10401452?v=3","gravatar_id":"","url":"https://api.github.com/users/nercof","html_url":"https://github.com/nercof","followers_url":"https://api.github.com/users/nercof/followers","following_url":"https://api.github.com/users/nercof/following{/other_user}","gists_url":"https://api.github.com/users/nercof/gists{/gist_id}","starred_url":"https://api.github.com/users/nercof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nercof/subscriptions","organizations_url":"https://api.github.com/users/nercof/orgs","repos_url":"https://api.github.com/users/nercof/repos","events_url":"https://api.github.com/users/nercof/events{/privacy}","received_events_url":"https://api.github.com/users/nercof/received_events","type":"User","site_admin":false},"created_at":"2016-08-26T19:16:33Z","updated_at":"2016-08-26T19:16:33Z","body":"El problema radica que ambas soluciones generan los *estados* que empleamos en la aplicación. Por ejemplo:\r\n\r\n```html\r\n<div ng-controller=\"tokkoController as vm\">\r\n```\r\n\r\nGenera el estado _tokko_ que tiene asociada la vista _tokko.view.html_. Esta es la forma que se hacía anteriormente a la introducción de `$stateProvider `.\r\n\r\nLo anterior es lo mismo a:\r\n```javascript\r\n    .state('tokko', {\r\n        url: '/tokko',\r\n        views:{\r\n          \"tokko\":{\r\n               templateUrl: localized.views + \"tokko.view.html\",\r\n               controller: 'tokkoController as vm'     \r\n          }\r\n        }\r\n    });\r\n```\r\nPor lo que vamos a optar por implementarlo desde el $stateProvider en vez desde la view con ng-controller, al menos para este caso. Una ventaja a ésto es:\r\n\r\n_Controllers are instantiated on an as-needed basis, when their corresponding scopes are created, i.e. when the user manually navigates to a state via a URL, $stateProvider will load the correct template into the view, then bind the controller to the template's scope._\r\n\r\n"}}
{"actor":{"display_login":"nercof"}}