If the second parameter, “delay” is not provided, the default behaviour is to execute the function after the DOM has completed rendering. So instead of setTimeout, use $timeout:
$timeout(function () {
//DOM has finished rendering
});
More Related Contents:
- How to cancel an $http request in AngularJS?
- htaccess redirect for Angular routes
- AngularJS. How to call controller function from outside of controller component
- When writing a directive in AngularJS, how do I decide if I need no new scope, a new child scope, or a new isolated scope?
- Dynamic validation and name in a form with AngularJS
- How to use $http promise response outside success handler
- Can I use ng-model with isolated scope?
- AngularJS : Where to use promises?
- Can you change a path without reloading the controller in AngularJS?
- AngularJS ng-style with a conditional expression
- How to allow only a number (digits and decimal point) to be typed in an input?
- AngularJS best practices for module declaration?
- How can I test events in angular?
- Using ui-router with Bootstrap-ui modal
- AngularJS watch DOM change
- How can I detect onKeyUp in AngularJS?
- Why ng-transclude’s scope is not a child of its directive’s scope – if the directive has an isolated scope?
- Recommended way of getting data from the server
- Why is using if(!$scope.$$phase) $scope.$apply() an anti-pattern?
- How to config routeProvider and locationProvider in angularJS?
- Compare objects in Angular
- Rendering Highcharts using Angular js Directives
- Angularjs: a Service that serves multiple $resource urls / data sources?
- Angular.js programmatically setting a form field to dirty
- How to detect browser using angularjs?
- How can I preserve new lines in an AngularJS partial?
- Exclamation mark after hash (#!) in angularjs app
- XMLHttpRequest cannot load and Response for preflight has invalid HTTP status code 405
- Prepend optional attribute in angular ui-router URL
- E2E mock $httpBackend doesn’t actually passThrough for me