I got the latest TypeScript via npm (npm install -g typescript
)
Version 1.7.5
When I run the typescript compile command on my file: tsc app.component.ts --module system
I get the following error: app.component.ts(15,7): error TS1146: Declaration expected.
import {Component} from 'angular2/core';
@Component({
selector: 'my-app',
// template: '<h1>My title: {{title}}</h1> <h2>Hardcoded h2</h2>'
})
@View({ // <- line 7
templateUrl: '/templates/home.html',
directives: []
})
.Class({
constructor: function() {
}
}); // <- line 15
export class AppComponent {
title = "My First Angular 2 App";
}
Anyone know what this error means?
Try this
import { Component } from '@angular/core';
you need to import View
from angular2/core
as well:
import {Component, View} from 'angular2/core';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With