From:
import {Component} from 'angular2/core';
To:
var core_1 = require('angular2/core');
I get in my browser some errors:
required is not defined
Why do I have to include requireJS as a runtime dependency? The angular 2 5 min tutorial does not anywhere include that library!
Thats annoying!
https://angular.io/guide/quickstart
When I do:
<script src="~/lib/require.js"></script>
I still get the error because of my compiled javascript:
UPDATE
These are the includes script in my header-tag:
<script src="~/lib/es6-shim.js"></script>
<script src="~/lib/es6-promise.js"></script>
<script src="~/lib/system-polyfills.js"></script>
<script src="~/lib/angular2-polyfills.js"></script>
<script src="~/lib/system.js"></script>
<script src="~/lib/Rx.js"></script>
<script src="~/lib/angular2.js"></script>
<script src="~/lib/http.dev.js"></script>
<script src="~/lib/router.dev.js"></script>
<script asp-src-include="~/app/**/*.js"></script>
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('app/main')
.then(null, console.error.bind(console));
</script>
UPDATE 2
You need SystemJS
, requirejs is not required (;
You might have an issue with loading bundles from node_modules
folder, if that's the case (check Devtools > Network), try using CDN versions:
<script src="https://code.angularjs.org/2.0.0-beta.0/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/tools/system.js"></script>
<script src="https://code.angularjs.org/tools/typescript.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.0/Rx.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.0/angular2.min.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.0/http.min.js"></script>
You are trying to manually load your script. You should let SystemJS
do it, just remove:
<script asp-src-include="~/app/**/*.js"></script>
and it should work...