Есть модуль core.module.ts:
import { NgModule } from '@angular/core';
import { TestDirective } from './test/test-directive';
import { Test } from './test/component';
@NgModule({
declarations: [
Test,
TestDirective
],
exports: [
Test,
TestDirective
]
})
export class CoreModule {
}
test-component.ts:
import { Component } from '@angular/core';
@Component({
selector: 'test',
template: 'test'
})
export class Test {
}
test-direcive.ts:
import { Directive } from "@angular/core";
@Directive({
selector: '[myTest]'
})
export class TestDirective{
}
header.module.ts:
@NgModule({
imports: [
CoreModule
],
declarations: [
AppComponent
]
...
template.html:
<test></test> <a href="/hello" [myTest]>hello</a>
Так вот, test нормально работает и выводит свой шаблон, а стоит добавить атрибут [myTest] получаю ошибку:
Unhandled Promise rejection: Template parse errors:
Can't bind to 'myTest' since it isn't a known property of 'a'.
что я делаю не так?