Reputation: 1065
Background:
I have an angularjs application which displays a datetimepicker field.
Issue:
Once the page is loaded I want to run a javascript function to initialize the datepicker used in the page. At the moment it seems that the function call that I placed at the end of the page doesn't get picked.
Note : I use the 'bootstrap datetimepicker' from (http://eonasdan.github.io/bootstrap-datetimepicker/)
Upvotes: 0
Views: 1084
Reputation: 5254
The only way to know when Angular is done is from inside Angular. You should wrap the code that initalizes the date picker into a directive, add binding as needed, and in a $timeout function do the JS initialization.
Upvotes: 0
Reputation: 2220
Just use the $viewContentLoaded event
$scope.$on('$viewContentLoaded', function() {
//call it here
yourFunction();
});
Upvotes: 2