【发布时间】:2017-08-22 23:09:50
【问题描述】:
离子设置:
离子框架:2.3.0
Ionic 应用脚本:1.1.4
Angular 核心:2.4.8
Angular 编译器 CLI:2.4.8
节点:4.2.6
我是 ionic 和 angular 的新手,我正在尝试使用 ionic 标签创建自定义组件,看看我的代码:
mynavbar.component.ts
import {Component} from "@angular/core";
import {IONIC_DIRECTIVES} from 'ionic-angular';
@Component({
selector: 'my-navbar',
directives: [IONIC_DIRECTIVES],
templateUrl: 'mynavbar.component.html'
})
export class MyNavbarComponent {}
这是我的模板网址:
<ion-header>
<ion-toolbar>
<ion-buttons start>
<button ion-button icon-only>
<ion-icon name="contact"></ion-icon>
</button>
</ion-buttons>
<ion-title>MyApp</ion-title>
<ion-buttons end>
<button ion-button icon-only>
<ion-icon name="pin"></ion-icon>
</button>
</ion-buttons>
</ion-toolbar>
<ion-segment color="primary">
<ion-segment-button value="pessoas">
Pessoas
</ion-segment-button>
<ion-segment-button value="grupos">
Grupos
</ion-segment-button>
</ion-segment>
</ion-header>
我收到此错误:没有导出的成员 'IONIC_DIRECTIVES'。 我正在尝试导入 IONIC_DIRECTIVES,因为我在这里看到一些回答者说如果我们需要将其导入到我们的组件中在自定义组件中使用离子标签,但我收到此错误。
@edit 如果我选择不导入 Ionic_Directives,我不会收到任何错误,但我在自定义组件中使用的所有 ionic 标签都会丢失所有样式
【问题讨论】:
标签: angularjs angular ionic-framework ionic2