{"action":"created","issue":{"url":"https://api.github.com/repos/valor-software/ngx-bootstrap/issues/3809","repository_url":"https://api.github.com/repos/valor-software/ngx-bootstrap","labels_url":"https://api.github.com/repos/valor-software/ngx-bootstrap/issues/3809/labels{/name}","comments_url":"https://api.github.com/repos/valor-software/ngx-bootstrap/issues/3809/comments","events_url":"https://api.github.com/repos/valor-software/ngx-bootstrap/issues/3809/events","html_url":"https://github.com/valor-software/ngx-bootstrap/issues/3809","id":297739206,"number":3809,"title":"ExpressionChangedAfterItHasBeenCheckedError when using variables inside ng-template with ModalModule","user":{"login":"BarrMan","id":6408092,"avatar_url":"https://avatars3.githubusercontent.com/u/6408092?v=4","gravatar_id":"","url":"https://api.github.com/users/BarrMan","html_url":"https://github.com/BarrMan","followers_url":"https://api.github.com/users/BarrMan/followers","following_url":"https://api.github.com/users/BarrMan/following{/other_user}","gists_url":"https://api.github.com/users/BarrMan/gists{/gist_id}","starred_url":"https://api.github.com/users/BarrMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BarrMan/subscriptions","organizations_url":"https://api.github.com/users/BarrMan/orgs","repos_url":"https://api.github.com/users/BarrMan/repos","events_url":"https://api.github.com/users/BarrMan/events{/privacy}","received_events_url":"https://api.github.com/users/BarrMan/received_events","type":"User","site_admin":false},"labels":[{"id":411822414,"url":"https://api.github.com/repos/valor-software/ngx-bootstrap/labels/comp(modal)","name":"comp(modal)","color":"0e8a16","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-16T10:27:11Z","updated_at":"2018-02-16T10:51:15Z","closed_at":"2018-02-16T10:51:15Z","author_association":"NONE","body":"### Bug description or feature request:\r\n1. Calling `BsModalService.show` inside `ngOnInit` on an `ng-template` located in the view. - works\r\n2. Adding a variable on the scope of the component and inside the `ng-template`. - works\r\n3. Wrapping the whole component tag with `*ngIf` causes `ExpressionChangedAfterItHasBeenCheckedError` exception to throw.\r\n\r\nI've found a workaround:\r\n`Calling window.setTimeout(() => {\r\nthis._bsModalService.show(this.template);\r\n});`\r\n\r\n### Plunker/StackBlitz that reproduces the issue:\r\nPlunkr: https://plnkr.co/edit/ppGeFBYPhHVXFZML16u1?p=preview\r\n\r\n*This sample was produced using the default plunkr starter project."},"comment":{"url":"https://api.github.com/repos/valor-software/ngx-bootstrap/issues/comments/366203532","html_url":"https://github.com/valor-software/ngx-bootstrap/issues/3809#issuecomment-366203532","issue_url":"https://api.github.com/repos/valor-software/ngx-bootstrap/issues/3809","id":366203532,"user":{"login":"IlyaSurmay","id":18414330,"avatar_url":"https://avatars2.githubusercontent.com/u/18414330?v=4","gravatar_id":"","url":"https://api.github.com/users/IlyaSurmay","html_url":"https://github.com/IlyaSurmay","followers_url":"https://api.github.com/users/IlyaSurmay/followers","following_url":"https://api.github.com/users/IlyaSurmay/following{/other_user}","gists_url":"https://api.github.com/users/IlyaSurmay/gists{/gist_id}","starred_url":"https://api.github.com/users/IlyaSurmay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IlyaSurmay/subscriptions","organizations_url":"https://api.github.com/users/IlyaSurmay/orgs","repos_url":"https://api.github.com/users/IlyaSurmay/repos","events_url":"https://api.github.com/users/IlyaSurmay/events{/privacy}","received_events_url":"https://api.github.com/users/IlyaSurmay/received_events","type":"User","site_admin":false},"created_at":"2018-02-16T10:51:15Z","updated_at":"2018-02-16T10:51:15Z","author_association":"MEMBER","body":"Hi! That's an old one - https://github.com/angular/angular/issues/15634\r\nAngular throws this error if you're creating a view during a change detection hook.\r\n`setTimeout` and `Promise.resolve(null).then(() => [...})` are workarounds for this."}}
{"actor":{"display_login":"IlyaSurmay"}}