BF: Prevent controllers from being instantiated twice.

AngularJS will instantiate it when discovering ng-controller in their respective html files
This commit is contained in:
Emmanuel ROHEE 2014-09-02 15:12:51 +02:00
parent d5da6b0cef
commit e565a4bfc4
1 changed files with 7 additions and 14 deletions

View File

@ -36,34 +36,27 @@ matrixWebClient.config(['$routeProvider', '$provide', '$httpProvider',
function($routeProvider, $provide, $httpProvider) { function($routeProvider, $provide, $httpProvider) {
$routeProvider. $routeProvider.
when('/login', { when('/login', {
templateUrl: 'login/login.html', templateUrl: 'login/login.html'
controller: 'LoginController'
}). }).
when('/register', { when('/register', {
templateUrl: 'login/register.html', templateUrl: 'login/register.html'
controller: 'RegisterController'
}). }).
when('/room/:room_id_or_alias', { when('/room/:room_id_or_alias', {
templateUrl: 'room/room.html', templateUrl: 'room/room.html'
controller: 'RoomController'
}). }).
when('/room/', { // room URL with room alias in it (ex: http://127.0.0.1:8000/#/room/#public:localhost:8080) will come here. when('/room/', { // room URL with room alias in it (ex: http://127.0.0.1:8000/#/room/#public:localhost:8080) will come here.
// The reason is that 2nd hash key breaks routeProvider parameters cutting so that the URL will not match with // The reason is that 2nd hash key breaks routeProvider parameters cutting so that the URL will not match with
// the previous '/room/:room_id_or_alias' URL rule // the previous '/room/:room_id_or_alias' URL rule
templateUrl: 'room/room.html', templateUrl: 'room/room.html'
controller: 'RoomController'
}). }).
when('/', { when('/', {
templateUrl: 'home/home.html', templateUrl: 'home/home.html'
controller: 'HomeController'
}). }).
when('/settings', { when('/settings', {
templateUrl: 'settings/settings.html', templateUrl: 'settings/settings.html'
controller: 'SettingsController'
}). }).
when('/user/:user_matrix_id', { when('/user/:user_matrix_id', {
templateUrl: 'user/user.html', templateUrl: 'user/user.html'
controller: 'UserController'
}). }).
otherwise({ otherwise({
redirectTo: '/' redirectTo: '/'