Skip to content

Commit 500df53

Browse files
committed
Commit zawui08
1 parent c4848aa commit 500df53

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

frontend/src/app/common/models/categories.model.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
class CategoriesModel {
2-
constructor($q) {
2+
constructor($q, $rootScope) {
33
'ngInject';
44

55
this.$q = $q;
6+
this.$rootScope = $rootScope;
67
this.currentCategory = null;
78
this.categories = [
89
{"id": 0, "name": "Development"},
@@ -18,6 +19,7 @@ class CategoriesModel {
1819

1920
setCurrentCategory(category) {
2021
this.currentCategory = category;
22+
this.$rootScope.$broadcast('onCurrentCategoryUpdated');
2123
}
2224

2325
getCurrentCategory() {

frontend/src/app/components/bookmarks/bookmarks.controller.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
class BookmarksController {
2-
constructor(CategoriesModel, BookmarksModel) {
2+
constructor($scope, CategoriesModel, BookmarksModel) {
33
'ngInject';
44

5+
this.$scope = $scope;
56
this.CategoriesModel = CategoriesModel;
67
this.BookmarksModel = BookmarksModel;
78
}
@@ -12,6 +13,7 @@ class BookmarksController {
1213
this.bookmarks = bookmarks;
1314
});
1415

16+
this.$scope.$on('onCurrentCategoryUpdated', this.reset.bind(this));
1517
this.getCurrentCategory = this.CategoriesModel.getCurrentCategory.bind(this.CategoriesModel);
1618
this.deleteBookmark = this.BookmarksModel.deleteBookmark;
1719
}

0 commit comments

Comments
 (0)