JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.min.js"></script>
<div ng-app="app" ng-controller="MyCtrl" id="container">
<button ng-click="scroll()">Unhide element and scroll</button> (will not work until $timeout call is uncommented)
<div style="height:1000px; background-color: #ddddd0">
</div>
<div id="target" ng-show="isVisible">section to scroll to</div>
</div>
JavaScript
angular.module("app", [])
.controller('MyCtrl',
function MyCtrl($scope, $timeout) {
$scope.isVisible = false;
$scope.scroll = function() {
$scope.isVisible = true;
// uncommenting the $timeout fixes it, but feels like a hack
//$timeout(function() {
$('body').animate({
scrollTop: $("#target").offset().top
}, 500);
//});
};
}
);