In fact I found the answer myself. The problem was with app.js imports. The 
correct ones are:

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

Still my last question is valid: Is ES6 + Angular2 a recommended option?

четвъртък, 21 май 2015 г., 10:13:30 UTC+3, Vasil Vasilev написа:
>
> Hi,
>
> I was trying to rework the 5 MIN QUICKSTART guide so that it is written in 
> ES6, rather then in TypeScript. However I have problems with Angular 
> reading the annotations.
>
> *My html is:*
>
> <!-- index.html -->
> <html>
>   <head>
>     <title>Angular 2 Quickstart</title>
>     <script src="
> https://github.jspm.io/jmcriffey/[email protected]/traceur.js
> "></script>
> <script src="https://jspm.io/[email protected]";></script>
>     <script src="https://code.angularjs.org/2.0.0-alpha.22/angular2.dev.js
> "></script>
>   </head>
>   <body>
>   
>     <!-- The app component created in app.ts -->
>     <my-app></my-app>
>     <script>
> System.config({
> traceurOptions: traceur.util.Options.experimental()
> });
> System.import('app');
> </script>
>   </body>
> </html>
>
> *My app.js is:*
>
> import {Component, View, bootstrap} from 'angular2/angular2';
>
> // Component controller
> @Component({
>   selector: 'my-app'
> })
> @View({
>   template: '<h1>Hello {{ name }}</h1>'
> })
> class MyAppComponent {
>   
>   constructor() {
>     this.name = 'Alice';
>   }
> }
>
> bootstrap(MyAppComponent);
>
> *As result the following exception is generated:*
>
> Error during instantiation of Token(AppComponentAnnotatedType)!. ORIGINAL 
> ERROR: No Directive annotation found on MyAppComponent
>
> Error
>     at InstantiationError.BaseException (angular2.dev.js:5938)
>     at p (traceur.src.js:99)
>     at Function.<anonymous> (traceur.src.js:60)
>     at InstantiationError.AbstractBindingError (angular2.dev.js:8868)
>     at p (traceur.src.js:99)
>     at Function.<anonymous> (traceur.src.js:60)
>     at new InstantiationError (angular2.dev.js:8915)
>     at _AsyncInjectorStrategy.execute._AsyncInjectorStrategy._findOrCreate 
> (angular2.dev.js:20427)
>     at angular2.dev.js:20407
>     at p (traceur.src.js:99)
>
> *One additional question:* Is the variant Angular 2 with ES6 valid, or 
> the recommended approach is Angular 2 with TypeScript?
>
> Regards,
>
> Vasil
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to