Added New dataService - to sync mainController data with other scopes
This commit is contained in:
parent
3465ff3465
commit
c264d908fb
4 changed files with 12 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
angular.module('SeHub')
|
||||
.controller('mainController', ['$scope', '$rootScope', 'apiService', '$cookies', '$cookieStore', '$location', '$window',
|
||||
.controller('mainController', ['$scope', '$rootScope', 'dataService','apiService', '$cookies', '$cookieStore', '$location', '$window',
|
||||
|
||||
function($scope, $rootScope, apiService, $cookies, $cookieStore, $location, $window) {
|
||||
function($scope, $rootScope, dataService, apiService, $cookies, $cookieStore, $location, $window) {
|
||||
|
||||
var token = $cookies['com.sehub.www'];
|
||||
|
||||
|
@ -14,6 +14,7 @@ angular.module('SeHub')
|
|||
}
|
||||
$scope.loadingData = false;
|
||||
$scope.user = data;
|
||||
dataService.initService($scope); //Start Data Sync Service (For User)
|
||||
console.log(data);
|
||||
if ($scope.user.isFirstLogin) {
|
||||
$scope.menuObj = {};
|
||||
|
@ -24,7 +25,9 @@ angular.module('SeHub')
|
|||
$location.path('/home')
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
|
||||
$scope.menuItems = [{
|
||||
"title": "Dash Board",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
angular.module('SeHub')
|
||||
.controller('settingsController', ['$scope', '$rootScope', 'apiService', '$cookies', '$location', function($scope, $rootScope, apiService, $cookies, $location) {
|
||||
.controller('settingsController', ['$scope', '$rootScope', 'dataService','apiService', '$cookies', '$location',
|
||||
function($scope, $rootScope, dataService ,apiService, $cookies, $location) {
|
||||
|
||||
var token = $cookies['com.sehub.www'];
|
||||
|
||||
|
@ -34,6 +35,7 @@ angular.module('SeHub')
|
|||
$scope.profileMode = "Save Profile";
|
||||
$scope.profileModeIcon = "fa fa-floppy-o";
|
||||
} else {
|
||||
dataService.userBrodcast($scope.user);
|
||||
$scope.profileMode = "Edit Profile";
|
||||
$scope.profileModeIcon = "fa fa-pencil";
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
|
||||
<!-- Services -->
|
||||
<script src="templates/js/services/apiService.js"></script>
|
||||
<script src="templates/js/services/dataService.js"></script>
|
||||
|
||||
<!-- Controllers -->
|
||||
<script src="templates/js/controllers/mainController.js"></script>
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
I Am a: {{(user.isLecturer) ? "Lecturer" : "Student"}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Starting Edit Mode Div -->
|
||||
<div layout="column" ng-if="isEditMode">
|
||||
<div>
|
||||
<md-input-container>
|
||||
|
|
Loading…
Reference in a new issue