Subscribe to our list to receive the latest updates on Node on Fire

Class: Controllers

Controllers

new Controllers(app)

The Controllers module.

Parameters:
Name Type Description
app App

The app initializing this module.

Methods

addViewRoute(controllerPath, controllerConstructor)

Creates a view route to the path which returns the main template.

Parameters:
Name Type Description
controllerPath String

The path of the view.

controllerConstructor String

The controller.

controller(controllerConstructor)

Sets up a controller.

The controllerConstructor gets inherited by Controller and the constructor gets added to the system so routes can be generated and additional code can be generated.

Please note: the constructor itself, is never executed in the server-context. Instead, the constructor is passed to angular's controller method and a controller is created on the client-context.

function MyController($scope) {
    console.log(MyController);
}
app.controller(MyController);

MyController.prototype.view = function() {
    return this.template('index');
};

The Bridge module is responsible for generating the client-context controller. This Controllers module checks the controllerConstructor's prototype and creates any routes.

Parameters:
Name Type Description
controllerConstructor Constructor

The named controller constructor.

Do you have any questions or comments on this page? Start a discussion below.

comments powered by Disqus
Subscribe to our list to receive the latest updates on Node on Fire