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

An Angular example

We have been using ES2015 imports extensively throughout this chapter already, but let's emphasize when that was. As mentioned, all constructs used ES2015 modules, models, services, components, and modules. For the module, this looked like this:

import { NgModule } from '@angular/core';

@NgModule({
declarations: [],
imports: [],
exports: [],
providers: []
})
export class FeatureModule {}

Here, we see that we import the functionality we need and we end up exporting this class, thereby making it available for other constructs to consume. It's the same thing with modules, like so:

import { Component } from '@angular/core';

@Component({
selector: 'example'
})
export class ExampleComponent {}

The pipe, directive, and filter all follow the same pattern of importing what they need and exporting themselves to be included as part of an NgModule.

主站蜘蛛池模板: 元阳县| 长子县| 叶城县| 崇仁县| 新绛县| 宜宾市| 徐闻县| 闽侯县| 视频| 广元市| 沭阳县| 敦化市| 张家界市| 商城县| 嵊泗县| 江川县| 仪陇县| 绩溪县| 上蔡县| 新宁县| 英山县| 维西| 金华市| 墨脱县| 长子县| 缙云县| 天长市| 梧州市| 汉寿县| 蓬莱市| 岑溪市| 九江市| 封丘县| 湖南省| 冷水江市| 温泉县| 五寨县| 维西| 民勤县| 九龙坡区| 韶关市|