Monday, February 18, 2019

angularjs - Load a controller after main controller loaded completely

I have an angular application. In all of my HTML pages, I have 2 controller: "mainCtrl" and "thatPageCtrl"



I need to define queue for controllers. I want to launch mainCtrl first, after complete execution of mainCtrl, I want to load thatPageCtrl.




I'm authenticating users in all the route in mainCtrl, and I want to launch thatPageCtrl if authentication is true. And I'm binding some data to all pages in mainCtrl and I need to launch thatPageCtrl after these data bind completely from mainCtrl.



How can I do that?



My angular config code:



/* Assign Angular Application Name */
var dashboardApp = angular.module("dashboardApp" , ['ngRoute' , 'ngFileUpload']);

/* Configuration Ajax Routing */

dashboardApp.config(['$routeProvider' , '$locationProvider' , function($routeProvider , $locationProvider){

$routeProvider.
when("/home" ,
{templateUrl : "/home.html"}).
when("/signin" ,
{templateUrl : "/signin.html"}).
otherwise({templateUrl : "/home.html"});

$locationProvider.html5Mode(true);

$locationProvider.hashPrefix('!');

}]);

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...