Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
51
rated 0 times [  54] [ 3]  / answers: 1 / hits: 19936  / 9 Years ago, tue, january 12, 2016, 12:00:00

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?


More From » angular

 Answers
41

you need to import View from angular2/core as well:



import {Component, View} from 'angular2/core';


[#63760] Saturday, January 9, 2016, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
madilynndiannac

Total Points: 191
Total Questions: 93
Total Answers: 111

Location: France
Member since Thu, Oct 15, 2020
4 Years ago
;