官术网_书友最值得收藏!

Importing and using external classes 

An import can be accomplished with the keyword import, and can be declared in different ways, depending on what library you are using. An example of using Require.js is as follows:

  • Go back to your text editor, create a file called import.ts, and add the following code:
import MyBand = require('./export');
console.log(Myband());

 An example of using Common.js is as follows:

import { MyBand } from './export';
console.log(new Myband(['ZZ Top', 'Motorhead'], 3));
  • The second method has been adopted by the Angular team, because Angular uses Webpack, a module bundler building modern web applications.
主站蜘蛛池模板: 慈利县| 民县| 莱州市| 开原市| 宜州市| 唐山市| 乳源| 壤塘县| 郓城县| 巴彦淖尔市| 林芝县| 丰台区| 巴南区| 蒲江县| 乐亭县| 海兴县| 久治县| 安义县| 东乡| 沐川县| 五指山市| 五河县| 南华县| 如皋市| 资源县| 鄄城县| 龙里县| 铜川市| 忻州市| 青川县| 宜州市| 平顺县| 通海县| 客服| 自贡市| 遂溪县| 岐山县| 乐昌市| 花垣县| 富蕴县| 云龙县|