No console do navegador apresenta erro que não conseguiu localizar o NegociacaoController. Com isso nada mais funciona na página. Console do navegador Chrome:
DevTools failed to load SourceMap: Could not load content for http://localhost:3000/css/bootstrap.css.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load SourceMap: Could not load content for http://localhost:3000/css/bootstrap-theme.css.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
system.src.js:1043 GET http://localhost:3000/js/controllers/NegociacaoController 404 (Not Found)
W @ system.src.js:1043
(anonymous) @ system.src.js:1779
(anonymous) @ system.src.js:1778
(anonymous) @ system.src.js:2803
(anonymous) @ system.src.js:3381
(anonymous) @ system.src.js:3713
(anonymous) @ system.src.js:4105
(anonymous) @ system.src.js:4570
(anonymous) @ system.src.js:4839
(anonymous) @ system.src.js:408
Promise.then (async)
s @ system.src.js:402
i @ system.src.js:388
(anonymous) @ system.src.js:380
Promise.then (async)
o @ system.src.js:360
(anonymous) @ system.src.js:450
(anonymous) @ system.src.js:465
Promise.then (async)
(anonymous) @ system.src.js:443
Promise.then (async)
l @ system.src.js:417
s @ system.src.js:399
i @ system.src.js:388
(anonymous) @ system.src.js:544
a @ system.src.js:342
(anonymous) @ system.src.js:838
Promise.then (async)
import @ system.src.js:831
(anonymous) @ system.src.js:1802
(anonymous) @ (index):49
(index):49 (SystemJS) XHR error (404 Not Found) loading http://localhost:3000/js/controllers/NegociacaoController
Error: XHR error (404 Not Found) loading http://localhost:3000/js/controllers/NegociacaoController
Error loading http://localhost:3000/js/controllers/NegociacaoController as "./controllers/NegociacaoController" from http://localhost:3000/js/app.js
(anonymous) @ (index):49
Promise.catch (async)
(anonymous) @ (index):49
app.ts:
import { NegociacaoController } from './controllers/NegociacaoController';
const controller = new NegociacaoController();
$('.form').submit(controller.adiciona.bind(controller));
NegociacaoController.ts:
import { NegociacoesView } from '../views/NegociacoesView';
import { MensagemView } from '../views/MensagemView';
import { Negociacoes } from '../models/Negociacoes';
import { Negociacao } from '../models/Negociacao';
export class NegociacaoController {
private _inputData: JQuery;
private _inputQuantidade: JQuery;
private _inputValor: JQuery;
private _negociacoes = new Negociacoes();
private _negociacoesView = new NegociacoesView('#negociacoesView');
private _mensagemView = new MensagemView('#mensagemView');
constructor() {
this._inputData = $('#data');
this._inputQuantidade = $('#quantidade');
this._inputValor = $('#valor');
this._negociacoesView.update(this._negociacoes);
}
adiciona(event: Event) {
event.preventDefault();
const negociacao = new Negociacao(
new Date(this._inputData.val().replace(/-/g, ',')),
parseInt(this._inputQuantidade.val()),
parseFloat(this._inputValor.val())
);
this._negociacoes.adiciona(negociacao);
this._negociacoesView.update(this._negociacoes);
this._mensagemView.update('Negociação adicionada com sucesso!');
}
}