离子3中的指令示例,以前使用的方法不起作用 . 已经尝试过在离子2中实现指令的方式 .
import {Directive} from 'angular2/core';
@Directive({
selector: 'test',
template: './test.html'
)}
export class MyDirective { }
import {MyDirective } from './test'
@Page({
templateUrl: '../page.html',
directives: [MyDirective ],
})
1 回答
这可以通过以下方式实现:
ComponentA,父组件
acomponent.ts
acomponent.html
bcomponent.ts
bcomponent.html
app.module.ts
当您导航到
ComponentA
时,它会将ComponentB
注入选择器<component-b></component-b>
希望这会有所帮助