私は私がタグの検索オプションのテキストボックスを表示する必要があります角4で共有htmlを使用するには?
<search-items (search)="filter($event,'q')"></search-items>
を使用したい 、基本angular4ページ内の共有のhtmlを使用しようとしています。
私は私の誤差を除去するために何をすべきでしょうか?
私は私がタグの検索オプションのテキストボックスを表示する必要があります角4で共有htmlを使用するには?
<search-items (search)="filter($event,'q')"></search-items>
を使用したい 、基本angular4ページ内の共有のhtmlを使用しようとしています。
私は私の誤差を除去するために何をすべきでしょうか?
自分でこのコードを試してみてください。これはあなたのapp.ts
//our root app component
import {Component, NgModule, VERSION} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'
import {SearchComponent} from 'search.ts'
import {FormsModule } from '@angular/forms'
@Component({
selector: 'my-app',
template: '
<div>
<h2>Hello {{name}}</h2>
<search-items (search)="filter($event,'q')"></search-items>
</div>',
declare:[SearchComponent]
})
export class App {
name:string;
constructor() {
this.name = `Angular! v${VERSION.full}`
}
filter(text:string,text2:string){
console.log("hi")
}
}
@NgModule({
imports: [ BrowserModule , FormsModule],
declarations: [ App , SearchComponent ],
bootstrap: [ App ]
})
export class AppModule {}
である第二の修正はsearch.tsにあった:あなたのsearch.htmlのはsearch.component.html
注意としてスペルミスました。コードでngModelを使用するたびに、Forms/Forms/Forms/Forms/FormsModuleをインポートします
の事を学んでいます。それをチェックして、何が足りないのか教えてください。 –
https://plnkr.co/edit/9fbMEcBj5cJBoywhqNwj?p=preview –
私に2分を教えてください見てください –
Aakash Uniyal's answerに加えて、問題が解決されたplnkrが新しく追加されました。
あなたはまた、
`import { FormsModule } from '@angular/forms'`
あなたは –
あなたは、物事の多くが欠落していた –
エラーを表示するために与えられたリンク、使用のコンソールウィンドウを実行することができ、それらを指定してくださいどのようなエラーを取得しているがFormsModuleインポートするために必要な、iはできる午前エラーを取り除く。今すぐ回答を投稿する –