diff --git a/src/app/app.component.css b/src/app/app.component.css index 34633e7..ba43f51 100644 --- a/src/app/app.component.css +++ b/src/app/app.component.css @@ -1,11 +1,3 @@ p { font-family: Lato; } - -.data-empty { - margin: 10px 20px; - padding-left: 5px; - border: solid 1px #aaa; - text-align: center; - line-height: 32pt; -} diff --git a/src/app/app.component.html b/src/app/app.component.html index 891a4fc..dee3748 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,4 +1,4 @@ - - - - +查詢條件: + +
+
查詢條件:{{ condition | json }}
diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 357d769..41d969d 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,13 +1,14 @@ -import { Component, Inject, OnInit } from '@angular/core'; -import { Observable } from 'rxjs'; - +import { Component } from '@angular/core'; @Component({ selector: 'my-app', templateUrl: './app.component.html', - styleUrls: [ './app.component.css' ], - providers:[{provide:'Message', useValue:'定義在根元件的訊息'}], + styleUrls: ['./app.component.css'], }) export class AppComponent { + condition = ''; + onSearch(): void { + console.log(`查詢條件:${this.condition}`); + } } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6a30fea..ad409b8 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,15 +1,14 @@ +import { FormsModule } from '@angular/forms'; import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { HttpClientModule } from '@angular/common/http'; import { HTTP_INTERCEPTORS } from '@angular/common/http'; import { AppComponent } from './app.component'; -import { ChildComponent } from './child/child.component'; -import { ParentComponent } from './parent/parent.component'; @NgModule({ - imports: [BrowserModule, HttpClientModule], - declarations: [AppComponent, ChildComponent, ParentComponent], + imports: [BrowserModule, FormsModule], + declarations: [AppComponent], bootstrap: [AppComponent], }) export class AppModule {} diff --git a/src/app/child/child.component.css b/src/app/child/child.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/child/child.component.html b/src/app/child/child.component.html deleted file mode 100644 index 8c58a2e..0000000 --- a/src/app/child/child.component.html +++ /dev/null @@ -1,2 +0,0 @@ -

Child Component

-{{message}} diff --git a/src/app/child/child.component.ts b/src/app/child/child.component.ts deleted file mode 100644 index d03c57e..0000000 --- a/src/app/child/child.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component, Host, Inject, Self, SkipSelf } from '@angular/core'; - -@Component({ - selector: 'app-child', - templateUrl: './child.component.html', - styleUrls: ['./child.component.css'], -}) -export class ChildComponent { - constructor(@Host() @Inject('Message') public message: string) {} -} diff --git a/src/app/parent/parent.component.css b/src/app/parent/parent.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/parent/parent.component.html b/src/app/parent/parent.component.html deleted file mode 100644 index 60e0ce6..0000000 --- a/src/app/parent/parent.component.html +++ /dev/null @@ -1,2 +0,0 @@ -

Parent Component

- diff --git a/src/app/parent/parent.component.ts b/src/app/parent/parent.component.ts deleted file mode 100644 index e97ad83..0000000 --- a/src/app/parent/parent.component.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-parent', - templateUrl: './parent.component.html', - styleUrls: ['./parent.component.css'], - providers:[{provide:'Message', useValue:'定義在父元件上的訊息'}], -}) -export class ParentComponent implements OnInit { - - constructor() { } - - ngOnInit(): void { - } - -}