{"action":"created","issue":{"url":"https://api.github.com/repos/miraxes/angular-custom-tour/issues/5","repository_url":"https://api.github.com/repos/miraxes/angular-custom-tour","labels_url":"https://api.github.com/repos/miraxes/angular-custom-tour/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/miraxes/angular-custom-tour/issues/5/comments","events_url":"https://api.github.com/repos/miraxes/angular-custom-tour/issues/5/events","html_url":"https://github.com/miraxes/angular-custom-tour/issues/5","id":301148057,"number":5,"title":"Auto start not working","user":{"login":"aimingxu","id":12042527,"avatar_url":"https://avatars3.githubusercontent.com/u/12042527?v=4","gravatar_id":"","url":"https://api.github.com/users/aimingxu","html_url":"https://github.com/aimingxu","followers_url":"https://api.github.com/users/aimingxu/followers","following_url":"https://api.github.com/users/aimingxu/following{/other_user}","gists_url":"https://api.github.com/users/aimingxu/gists{/gist_id}","starred_url":"https://api.github.com/users/aimingxu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aimingxu/subscriptions","organizations_url":"https://api.github.com/users/aimingxu/orgs","repos_url":"https://api.github.com/users/aimingxu/repos","events_url":"https://api.github.com/users/aimingxu/events{/privacy}","received_events_url":"https://api.github.com/users/aimingxu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-28T19:16:14Z","updated_at":"2018-02-28T20:35:54Z","closed_at":null,"author_association":"NONE","body":"I want to auto start the tour after page load without click a button or link. Here is my code:\r\nngAfterContentInit(){\r\n\tsetTimeout(function(){\r\n            this.hintService.initialize();\r\n}, 4000);\r\n}\r\nI got ERROR TypeError: Cannot read property 'initialize' of undefined.\r\n"},"comment":{"url":"https://api.github.com/repos/miraxes/angular-custom-tour/issues/comments/369373969","html_url":"https://github.com/miraxes/angular-custom-tour/issues/5#issuecomment-369373969","issue_url":"https://api.github.com/repos/miraxes/angular-custom-tour/issues/5","id":369373969,"user":{"login":"miraxes","id":5033771,"avatar_url":"https://avatars1.githubusercontent.com/u/5033771?v=4","gravatar_id":"","url":"https://api.github.com/users/miraxes","html_url":"https://github.com/miraxes","followers_url":"https://api.github.com/users/miraxes/followers","following_url":"https://api.github.com/users/miraxes/following{/other_user}","gists_url":"https://api.github.com/users/miraxes/gists{/gist_id}","starred_url":"https://api.github.com/users/miraxes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miraxes/subscriptions","organizations_url":"https://api.github.com/users/miraxes/orgs","repos_url":"https://api.github.com/users/miraxes/repos","events_url":"https://api.github.com/users/miraxes/events{/privacy}","received_events_url":"https://api.github.com/users/miraxes/received_events","type":"User","site_admin":false},"created_at":"2018-02-28T20:35:54Z","updated_at":"2018-02-28T20:35:54Z","author_association":"OWNER","body":"@aimingxu \r\nyou just losing a *this* context . There are 2 ways to avoid it\r\n1. bind this to some variable (old style)\r\n`ngAfterContentInit(){\r\nvar self = this;\r\nsetTimeout(function(){\r\nself.hintService.initialize();\r\n}, 4000);\r\n}`\r\n2. And ES6 one is using lambda(arrow)\r\n`ngAfterContentInit(){\r\nsetTimeout(() => {\r\nthis.hintService.initialize();\r\n}, 4000);\r\n}`"}}
{"actor":{"display_login":"miraxes"}}