Whilst I have looked at the answers here, I'm still unable to trigger my openModal() function on page load.
Within my controller, I have the code (below question), which does allow openModal() to trigger fine either from an ng-click directive or when entering the following in the Chrome console:
angular.element($0).scope().openModal()
My problem is when I'm trying to conditionally open the modal upon page load. My current code is:
$scope.openModal = function (size) {
modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: 'pageBuilder',
size: 'lg',
resolve: {
items: function () {
return $scope.chosenDeploymentSchedule;
}
}
});
};
angular.element(document).ready(function () {
// $scope.openModal();
console.log('Hello World');
});
I do get my Hello World printing, but when I try uncommenting the $scope.openModal();, I get an infinite loop of undefined + Hello World printing out.