{"action":"created","issue":{"url":"https://api.github.com/repos/angular-ui/bootstrap/issues/5192","labels_url":"https://api.github.com/repos/angular-ui/bootstrap/issues/5192/labels{/name}","comments_url":"https://api.github.com/repos/angular-ui/bootstrap/issues/5192/comments","events_url":"https://api.github.com/repos/angular-ui/bootstrap/issues/5192/events","html_url":"https://github.com/angular-ui/bootstrap/issues/5192","id":125780283,"number":5192,"title":"[Collapse] First animation is still ran","user":{"login":"bogdanalexe90","id":8752468,"avatar_url":"https://avatars.githubusercontent.com/u/8752468?v=3","gravatar_id":"","url":"https://api.github.com/users/bogdanalexe90","html_url":"https://github.com/bogdanalexe90","followers_url":"https://api.github.com/users/bogdanalexe90/followers","following_url":"https://api.github.com/users/bogdanalexe90/following{/other_user}","gists_url":"https://api.github.com/users/bogdanalexe90/gists{/gist_id}","starred_url":"https://api.github.com/users/bogdanalexe90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bogdanalexe90/subscriptions","organizations_url":"https://api.github.com/users/bogdanalexe90/orgs","repos_url":"https://api.github.com/users/bogdanalexe90/repos","events_url":"https://api.github.com/users/bogdanalexe90/events{/privacy}","received_events_url":"https://api.github.com/users/bogdanalexe90/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular-ui/bootstrap/labels/component:%20collapse","name":"component: collapse","color":"ffffff"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/angular-ui/bootstrap/milestones/33","html_url":"https://github.com/angular-ui/bootstrap/milestones/1.0.1","labels_url":"https://api.github.com/repos/angular-ui/bootstrap/milestones/33/labels","id":1492155,"number":33,"title":"1.0.1","description":"","creator":{"login":"wesleycho","id":1703387,"avatar_url":"https://avatars.githubusercontent.com/u/1703387?v=3","gravatar_id":"","url":"https://api.github.com/users/wesleycho","html_url":"https://github.com/wesleycho","followers_url":"https://api.github.com/users/wesleycho/followers","following_url":"https://api.github.com/users/wesleycho/following{/other_user}","gists_url":"https://api.github.com/users/wesleycho/gists{/gist_id}","starred_url":"https://api.github.com/users/wesleycho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wesleycho/subscriptions","organizations_url":"https://api.github.com/users/wesleycho/orgs","repos_url":"https://api.github.com/users/wesleycho/repos","events_url":"https://api.github.com/users/wesleycho/events{/privacy}","received_events_url":"https://api.github.com/users/wesleycho/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":19,"state":"open","created_at":"2016-01-08T17:17:01Z","updated_at":"2016-01-11T16:37:55Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2016-01-09T20:39:52Z","updated_at":"2016-01-11T16:38:09Z","closed_at":null,"body":"Collapse has a strange flickering when is opened by default at first rendering and some delayed content is loaded. I took a look in the collapse directive and the `expand()` logic is still ran.\r\n\r\n```js\r\n// This should add `collapse in` class\r\nif (!scope.$eval(attrs.uibCollapse)) {\r\n          element.addClass('in')\r\n            .addClass('collapse')\r\n            .css({height: 'auto'});\r\n}\r\n\r\nfunction expand() {\r\n    ...\r\n          if ($animateCss) {\r\n            $animateCss(element, {\r\n              addClass: 'in',\r\n              easing: 'ease',\r\n\r\n              // if the async content is loaded after this\r\n              // it will cause an animation towards the new scrollHeight\r\n\r\n              to: { height: element[0].scrollHeight + 'px' }\r\n            }).start()['finally'](expandDone);\r\n          } else {\r\n            ...\r\n          }\r\n        }\r\n\r\n// Still the watcher will trigger expand logic\r\nscope.$watch(attrs.uibCollapse, function(shouldCollapse) {\r\n          if (shouldCollapse) {\r\n            collapse();\r\n          } else {\r\n            expand();\r\n          }\r\n        });\r\n```\r\n\r\nBecause we need to skip `expand()` only for the first rendering we can add a simple check inside the watcher:\r\n```js\r\nscope.$watch(attrs.uibCollapse, function(shouldCollapse) {\r\n          if (shouldCollapse) {\r\n            collapse();\r\n          } else {\r\n            if(arguments[0] !== arguments[1]){\r\n                expand();\r\n            }\r\n          }\r\n        });\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/angular-ui/bootstrap/issues/comments/170611353","html_url":"https://github.com/angular-ui/bootstrap/issues/5192#issuecomment-170611353","issue_url":"https://api.github.com/repos/angular-ui/bootstrap/issues/5192","id":170611353,"user":{"login":"icfantv","id":370054,"avatar_url":"https://avatars.githubusercontent.com/u/370054?v=3","gravatar_id":"","url":"https://api.github.com/users/icfantv","html_url":"https://github.com/icfantv","followers_url":"https://api.github.com/users/icfantv/followers","following_url":"https://api.github.com/users/icfantv/following{/other_user}","gists_url":"https://api.github.com/users/icfantv/gists{/gist_id}","starred_url":"https://api.github.com/users/icfantv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icfantv/subscriptions","organizations_url":"https://api.github.com/users/icfantv/orgs","repos_url":"https://api.github.com/users/icfantv/repos","events_url":"https://api.github.com/users/icfantv/events{/privacy}","received_events_url":"https://api.github.com/users/icfantv/received_events","type":"User","site_admin":false},"created_at":"2016-01-11T16:38:09Z","updated_at":"2016-01-11T16:38:09Z","body":"Awesome, thanks."}}