I
I
Innokenty Ivanov2016-10-01 15:49:37
Angular
Innokenty Ivanov, 2016-10-01 15:49:37

What's wrong with a simple Angular 2 (TypeScript) web application?

I have an EventListComponent component

import { Component } from 'angular2/core';

@Component ({
    selector: 'el-events',
    templateUrl: 'app/events/event-list.component.html'
})

export class EventListComponent {
    pageTitle: string = 'Events List';
}

Which should be rendered in AppComponent
import { Component } from 'angular2/core';
import { EventListComponent } from './events/event-list.component';

@Component({
    selector: 'events-app',
    template: `
    <div>
        <h1>{{pageTitle}}</h1>
        <el-events></el-events>
    </div>`,
    directives: [ EventListComponent ]
})

export class AppComponent {
    pageTitle: string = 'Local Events App';
}

Directives, selectors, imports / exports and, in general, the decorator set up correctly.
Yes, I use the directive version of Angular, for educational purposes, of course.
But the page is not displayed, in the browser console there is an error:
6ed76c8d53ab4558a6e0831d03314dbc.png
Code structure:
df652f9accc54e508c8dc7d1328add63.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question