diff --git a/dashboard/src/components/notification/che-notification-config.js b/dashboard/src/components/notification/che-notification-config.js
index af61bf3ea7a..085b10a5130 100644
--- a/dashboard/src/components/notification/che-notification-config.js
+++ b/dashboard/src/components/notification/che-notification-config.js
@@ -11,11 +11,13 @@
'use strict';
import {CheNotification} from './che-notification.factory';
+import {CheNotificationController} from './che-notification.controller';
export class CheNotificationConfig {
constructor(register) {
+ register.controller('CheNotificationController', CheNotificationController);
register.factory('cheNotification', CheNotification);
diff --git a/dashboard/src/components/notification/che-notification.controller.js b/dashboard/src/components/notification/che-notification.controller.js
new file mode 100644
index 00000000000..d163fa4604c
--- /dev/null
+++ b/dashboard/src/components/notification/che-notification.controller.js
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2015-2016 Codenvy, S.A.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Codenvy, S.A. - initial API and implementation
+ */
+'use strict';
+
+/**
+ * Controller of the toasts
+ * @author Florent Benoit
+ */
+export class CheNotificationController {
+
+ /**
+ * Default constructor that is using resource injection
+ * @ngInject for Dependency injection
+ */
+ constructor($mdToast) {
+ this.$mdToast = $mdToast;
+ }
+
+ /**
+ * Hide the notification.
+ */
+ hideNotification() {
+ this.$mdToast.hide();
+ }
+
+}
diff --git a/dashboard/src/components/notification/che-notification.factory.js b/dashboard/src/components/notification/che-notification.factory.js
index 715337e0b9a..2f62fd4963b 100644
--- a/dashboard/src/components/notification/che-notification.factory.js
+++ b/dashboard/src/components/notification/che-notification.factory.js
@@ -33,12 +33,11 @@ export class CheNotification {
'Success' +
'' + text + '' +
'' +
- '' +
+ '' +
'',
autoWrap: false,
- controller: ['$scope', ($scope) => {
- $scope.hideNotification = this.$mdToast.hide;
- }],
+ controller: 'CheNotificationController',
+ controllerAs: 'cheNotificationCtrl',
hideDelay: 3000
});
}
@@ -52,12 +51,11 @@ export class CheNotification {
'Failed' +
'' + text + '' +
'' +
- '' +
+ '' +
'',
autoWrap: false,
- controller: ['$scope', ($scope) => {
- $scope.hideNotification = this.$mdToast.hide;
- }],
+ controller: 'CheNotificationController',
+ controllerAs: 'cheNotificationCtrl',
hideDelay: 20000
});
}