Loading modules in TypeScript using System.js

本秂侑毒 提交于 2019-11-30 18:38:33

Lets try to simplify things a bit:

1) Configure your systemjs as following:

System.defaultJSExtensions = true;

2) Make sure that both your classes.ts and model.ts and bootstrap.ts (this is new file you should create, that will bootstrap your app) files are transpiled an located in the same directory as index.html (index.html should contain script to configure systemjs as specified above)

3) In bootstrap.ts:

import {BlogModel} from  "./model"
let model = new BlogModel();
console.log(model);

3) Bootstrap your application with single call to System.import:

System.import('bootstrap').then(null, console.error.bind(console));

Try these steps and I think you will solve your problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!