Run initialize code before startup of angularjs app

  • 1 Replies
  • 1590 Views
Run initialize code before startup of angularjs app
« on: May 19, 2016, 16:55:25 pm »
I want to run a few lines of code before my app controllers/directives.

Whats the best way to achieve this ?

*

Oren

  • **
  • 59
Re: Run initialize code before startup of angularjs app
« Reply #1 on: May 22, 2016, 20:27:16 pm »
Code
var app = angular.module('myApp', []);

app.run(function($rootScope) {
    // init code
});

 

Sitemap 1 2 3 4 5 6 7 8