0

I'm gettin an error running my angular 2 app, this is my app.js

import 'zone.js/lib/browser/zone-microtask';
import 'reflect-metadata';

import { Component, View, bootstrap } from 'angular2/angular2';
import { HelloComponent } from './hello.component';

@Component({
  selector: 'hello-app'
})
@View({
  directives: [HelloComponent],
  template: `
    <div>
      <hello-component></hello-component>
    </div>
  `
})
class HelloApp { }

bootstrap(HelloApp, []);

and this is the error:

{ [SyntaxError: /code/angular2-example/app.js: Unexpected token (7:0) while parsing file: /code/angular2-example/app.js] pos: 190, loc: Position { line: 7, column: 0 }, _babel: true, codeFrame: '\u001b[0m 5 | \u001b[36mimport\u001b[39m \u001b[32m{\u001b[39m HelloComponent \u001b[32m}\u001b[39m from \u001b[31m\'./hello.component\'\u001b[39m\u001b[1m;\u001b[22m\n 6 | \n> 7 | \u001b[7m@\u001b[27mComponent\u001b[34m\u001b[1m(\u001b[22m\u001b[39m\u001b[32m{\u001b[39m\n | ^\n 8 | selector\u001b[1m:\u001b[22m \u001b[31m\'hello-app\'\u001b[39m\n 9 | \u001b[32m}\u001b[39m\u001b[34m\u001b[1m)\u001b[22m\u001b[39m\n 10 | \u001b[7m@\u001b[27mView\u001b[34m\u001b[1m(\u001b[22m\u001b[39m\u001b[32m{\u001b[39m\u001b[0m', filename: 'code/angular2-example/app.js',

but I don't see it. please can you help me. I am just starting with angular 2.

Sanket
  • 19,295
  • 10
  • 71
  • 82
Pxion
  • 105
  • 3
  • 10

1 Answers1

0

your import statement is wrong!

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

import it from "@angular/core'

   import {Component} from '@angular/core';
   import (bootstrap) from 'angular2/platform.browser';

Component is imported from angular/core, View is no more a class in angular

Anubhav Sahu
  • 71
  • 1
  • 9