2017-02-27 01:44:23 +01:00
|
|
|
"use strict";
|
|
|
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
|
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
};
|
|
|
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
};
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
var core_1 = require("@angular/core");
|
|
|
|
var initialEntries_1 = require("./initialEntries");
|
|
|
|
var blog_entry_1 = require("./blog-entry");
|
|
|
|
var AppComponent = (function () {
|
|
|
|
function AppComponent() {
|
|
|
|
this.entries = [];
|
2017-02-28 20:12:40 +01:00
|
|
|
this.id = 0;
|
2017-02-27 01:44:23 +01:00
|
|
|
this.entries = [];
|
|
|
|
this.entries = initialEntries_1.initialEntries;
|
2017-02-28 20:12:40 +01:00
|
|
|
this.id = this.entries[this.entries.length - 1].id;
|
2017-02-27 01:44:23 +01:00
|
|
|
}
|
|
|
|
AppComponent.prototype.createBlogEntry = function (title, image, text) {
|
2017-02-27 11:45:59 +01:00
|
|
|
this.id++;
|
|
|
|
console.log(this.id, title, image, text);
|
2017-02-27 01:44:23 +01:00
|
|
|
var entry = new blog_entry_1.BlogEntry();
|
2017-02-27 11:45:59 +01:00
|
|
|
entry.id = this.id;
|
2017-02-27 01:44:23 +01:00
|
|
|
entry.title = title;
|
|
|
|
entry.image = image;
|
|
|
|
entry.text = text;
|
|
|
|
this.entries.push(entry);
|
|
|
|
};
|
2017-02-27 11:45:59 +01:00
|
|
|
AppComponent.prototype.deleteBlogEntry = function (id) {
|
|
|
|
var entryIndex = this.entries.findIndex(function (entry) { return entry.id === id; });
|
|
|
|
if (entryIndex > -1) {
|
|
|
|
this.entries.splice(entryIndex, 1);
|
|
|
|
}
|
|
|
|
};
|
2017-02-27 01:44:23 +01:00
|
|
|
return AppComponent;
|
|
|
|
}());
|
|
|
|
AppComponent = __decorate([
|
|
|
|
core_1.Component({
|
|
|
|
moduleId: module.id,
|
|
|
|
selector: 'app-root',
|
|
|
|
templateUrl: 'app.component.html'
|
|
|
|
}),
|
|
|
|
__metadata("design:paramtypes", [])
|
|
|
|
], AppComponent);
|
|
|
|
exports.AppComponent = AppComponent;
|
|
|
|
//# sourceMappingURL=app.component.js.map
|