How do you attach a controller MEAN.IO home route

261 views Asked by At

The MEAN.IO route for home is controlled by the viewPathProvider. In the MEAN.IO docs they say that you can overload the home page by overloading the viewPathProvider config in your module.

angular.module('custom-package')
.config(['$viewPathProvider', function($viewPathProvider) {
         $viewPathProvider.override('system/views/index.html', 'custom-path');
}]);

However its not specified how to add an (AngularJS) controller to the view that is being loaded or how to associate a controller to it.

Hint in the system route there is a route where you can specify a controller but I would rather do this from my own package

    //Line 49 In system.js under system/public/routes 
    $meanStateProvider
  .state('home', {
    url: '/',
    templateUrl: 'system/views/index.html'
  //I can add a controller here but it will be stuck in the system package
  });

I also don't want to specify the controller in the HTML as most of my application is built with controllers specified in the route

0

There are 0 answers