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

Class: Controllers


new Controllers(app)

The Controllers module.

Name Type Description
app App

The app initializing this module.


addViewRoute(controllerPath, controllerConstructor)

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

Name Type Description
controllerPath String

The path of the view.

controllerConstructor String

The controller.


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) {

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.

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