>
> You either need a development environment, such as Visual Studio, that
>> compiles TypeScript into JavaScript every time you save a TypeScript file,
>> OR you need a 'transpiler' that you include in your index.html, and you
>> configure system.js to use the transpiler. A transpiler converts the
>> TypeScript into JavaScript in real-time, as the web page is loaded. This is
>> slower, but easier to get started with initially.
>>
>
Here's a Plunkr using Angular 2 that uses the Transpiler option:
https://plnkr.co/edit/FpQe81GewATx3E2zikgn?p=info
Look at config.js and you'll see this:
System.config({
//use typescript for compilation
transpiler: 'typescript',
//typescript compiler options
typescriptOptions: {
emitDecoratorMetadata: true
},
//map tells the System loader where to look for things
map: {
app: "./src"
},
//packages defines our app package
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts'
}
}
});
Note that you also need this in your index.html:
<script src="https://code.angularjs.org/tools/typescript.js"></script>
If you don't go the transpiler route, you don't need that, and system.js
needs to be configured differently.
--
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 https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.