angular4-testing/blog-complete/app/blog/app.component.ts

30 lines
611 B
TypeScript
Raw Normal View History

2017-02-27 01:44:23 +01:00
import {Component} from '@angular/core';
import {initialEntries} from './initialEntries';
import {BlogEntry} from './blog-entry';
@Component({
moduleId: module.id,
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent {
entries: BlogEntry[] = [];
constructor() {
this.entries = [];
this.entries = initialEntries
}
createBlogEntry(title:string, image:string, text:string) {
console.log(title, image, text);
let entry = new BlogEntry();
entry.title = title;
entry.image = image;
entry.text = text;
this.entries.push(entry);
}
}