-3
How the directive is used .run
angularjs?
-3
How the directive is used .run
angularjs?
2
var app = angular.module('aplicacao', ['highcharts-ng']);
app.run(function($rootScope) {
...
});
Explaining:
var app = angular.module('aplicacao', ['highcharts-ng']);
Creates an angular module called 'application' that injects the dependency of 'highcharts-ng''.
app.run(function($rootScope) {
It is the starting point of your application. As a comparison, it is equal to the main(args) of java/c#.
And inside it you will write your code with the desired functions (:
Okay Pedro, But what if you want to start a global variable on it? Inside the function?
Through $rootScope, as can be done in any other service, controller, etc..
Declare inside app.run(Function() { its global variable like any other variable in Javascript (var i = 0;)
Browser other questions tagged angularjs
You are not signed in. Login or sign up in order to post.
As a basic rule, I consider a question of poor quality whose text is exactly the same as the title. And, remembering, greetings and thanks are considered noisy: vine "Ain’t no blah blah blah" in the [tour]
– brasofilo