Reputation: 43419
Here is my entry point
import * as stylesheet from '../assets/styles/app.scss';
import jQuery from '../node_modules/jquery/dist/jquery';
import $ from '../node_modules/jquery/dist/jquery';
import {bootstrap} from './boot'
import {AppComponent} from './app.component'
bootstrap(AppComponent);
This works
(function (app) {
app.AppComponent = ng.core
.Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>'
})
.Class({
constructor: function () {
}
});
})(window.app || (window.app = {}));
I tried to use answer from How do I write angular2 without decorator syntax? without success.
IIFE
and use ES6
syntax?Upvotes: 3
Views: 418
Reputation: 4174
If you are using Babel and use the following plugins: 'angular2-annotations', 'transform-decorators-legacy', 'transform-class-properties', 'transform-flow-strip-types'
there is no need to convert the syntax.
You can check it also in a working example.
Upvotes: 1
Reputation: 11585
Untested!
import {Component} from 'angular2/core';
@Component({
selector: 'my-app',
template: `
<h1>
My First Angular 2 App
</h1>
`
})
export class AppComponent {
constructor () {
}
}
Perhaps you got a little confused by thinking you needed the app
variable?
Just to be clear you don't need to reference app
, you just need to import AppComponent
(as you already have)
Upvotes: 2