I would like to define my controller using the module pattern like this:
(function(ng, app) {
// Controller constructor.
function Controller($scope) {
this.scope = $scope;
this.scope.fmembers = [
{
name: 'Member 1',
role: 'Head of Family',
age: 55
},
{
name: 'Member 2',
role: 'Brother of Head of Family',
age: 51
}
];
Controller.prototype = {
getFMembers: function() {
return this.scope;
}
};
return( this );
}
// Define the Controller as the constructor function.
app.controller('ftreeController', Controller );
})(angular, anmDesktop);
If I do that how can I retrieve this controller (ftreeController) from the module? For example, I would like to use freeController in the routeprovider in app.config:
$routeProvider.when('/view2', {
templateUrl: 'partials/partial2.html',
controller: ftreeController'
});
In the routeprovider described above, I get an error (ftreeController not defined ...)
Thank you.