Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion projects/bank-v11/src/app/stores/account.store.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Injectable } from '@angular/core';
import { observable, autorun, computed, action } from 'mobx';
import { observable, autorun, computed, action, makeObservable } from 'mobx';
import { sum } from 'lodash';

@Injectable({ providedIn: 'root' })
export class Account {
@observable transactions: number[] = [];

constructor() {
makeObservable(this);
if (localStorage.savedTransactions) {
this.transactions = JSON.parse(localStorage.savedTransactions);
}
Expand Down
3 changes: 2 additions & 1 deletion projects/bank/src/app/stores/account.store.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Injectable } from '@angular/core';
import { observable, autorun, computed, action } from 'mobx';
import { observable, autorun, computed, action, makeObservable } from 'mobx';
import { sum } from 'lodash';

@Injectable()
export class Account {
@observable transactions: number[] = [];

constructor() {
makeObservable(this);
if (localStorage.savedTransactions) {
this.transactions = JSON.parse(localStorage.savedTransactions);
}
Expand Down
3 changes: 2 additions & 1 deletion projects/tictactoe/src/app/services/game.store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { observable, action, computed, reaction } from 'mobx';
import { observable, action, computed, reaction, makeObservable } from 'mobx';

const OPONENT = {
X: 'O',
Expand All @@ -13,6 +13,7 @@ export class GameStore {
@observable firstPlayer = 'X';

constructor() {
makeObservable(this);
this.resetGame();
this._countScore();
this._changeStartingPlayer();
Expand Down
5 changes: 4 additions & 1 deletion projects/todo/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { observable, computed, action } from 'mobx-angular';
import { Todos } from './stores/todos.store';
import { makeObservable } from 'mobx';

@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down Expand Up @@ -30,7 +31,9 @@ export class AppComponent {
return [this.title];
}

constructor(public todos: Todos) {}
constructor(public todos: Todos) {
makeObservable(this);
}

@action.bound addTodo() {
this.todos.addTodo({ title: this.title });
Expand Down
4 changes: 3 additions & 1 deletion projects/todo/src/app/stores/todos.store.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { observable, computed, action, autorun, toJS } from 'mobx';
import { observable, computed, action, autorun, toJS, makeObservable } from 'mobx';
import { Injectable } from '@angular/core';

export class Todo {
@observable completed = false;
@observable title: string;

constructor({ title, completed }) {
makeObservable(this);
this.completed = completed;
this.title = title;
}
Expand All @@ -21,6 +22,7 @@ export class Todos {
@observable filter = 'SHOW_ALL';

constructor() {
makeObservable(this);
this.localStorageSync();
}

Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"useDefineForClassFields": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
Expand Down