File tree Expand file tree Collapse file tree 6 files changed +91
-0
lines changed
pages/component/typeahead Expand file tree Collapse file tree 6 files changed +91
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,10 @@ const LAYOUT_ROUTES: Routes = [
7878 {
7979 path : 'toasty' ,
8080 loadChildren : ( ) => import ( '../pages/component/toasty/toasty.module' ) . then ( m => m . ToastyComponentModule )
81+ } ,
82+ {
83+ path : 'typeahead' ,
84+ loadChildren : ( ) => import ( '../pages/component/typeahead/typeahead.module' ) . then ( m => m . TypeaheadComponentModule )
8185 }
8286 ]
8387 } ,
Original file line number Diff line number Diff line change 5353 < li routerLinkActive ="navigation__active ">
5454 < a [routerLink] ="['/component/toasty'] "> < i class ="fa fa-newspaper-o "> </ i > Toasty</ a >
5555 </ li >
56+ < li routerLinkActive ="navigation__active ">
57+ < a [routerLink] ="['/component/typeahead'] "> < i class ="fa fa-tty "> </ i > Typeahead</ a >
58+ </ li >
5659 </ ul >
5760 </ li >
5861 < li routerLinkActive ="navigation__sub--active " class ="navigation__sub ">
Original file line number Diff line number Diff line change 1+ < section class ="content--row ">
2+ < header class ="content__title ">
3+ < h1 > Typeahead</ h1 >
4+ < small > This template is built using < code > ngx-bootstrap/typeahead</ code > and provides some usage examples</ small >
5+ </ header >
6+ < div class ="row ">
7+ < div class ="col-sm-6 ">
8+ < div class ="card ">
9+ < div class ="card-body ">
10+ < h4 class ="card-title "> Typeahead</ h4 >
11+ < div class ="form-group ">
12+ < input [(ngModel)] ="selected " [typeahead] ="states " class ="form-control " placeholder ="Enter S here ">
13+ < i class ="form-group__bar "> </ i >
14+ </ div >
15+ < pre > Selected data: {{selected | json}}</ pre >
16+ </ div >
17+ </ div >
18+ </ div >
19+ </ div >
20+ </ section >
Original file line number Diff line number Diff line change 1+ import { AfterViewInit , Component } from '@angular/core' ;
2+ import { TypeaheadService } from '@renderer/services/component/typeahead.service' ;
3+
4+ @Component ( {
5+ selector : 'app-component-typeahead' ,
6+ templateUrl : './typeahead.component.html'
7+ } )
8+ export class TypeaheadComponent implements AfterViewInit {
9+ selected : string ;
10+ states : string [ ] ;
11+
12+ constructor ( private typeaheadService : TypeaheadService ) {
13+ }
14+
15+ ngAfterViewInit ( ) {
16+ this . states = this . typeaheadService . states ;
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ import { CommonModule } from '@angular/common' ;
2+ import { NgModule } from '@angular/core' ;
3+ import { FormsModule } from '@angular/forms' ;
4+ import { RouterModule } from '@angular/router' ;
5+ import { BsDropdownModule } from 'ngx-bootstrap/dropdown' ;
6+ import { TypeaheadModule } from 'ngx-bootstrap/typeahead' ;
7+ import { TypeaheadComponent } from './typeahead.component' ;
8+ import { TypeaheadService } from '@renderer/services/component/typeahead.service' ;
9+
10+ const TYPEAHEAD_ROUTES = [
11+ { path : '' , component : TypeaheadComponent }
12+ ] ;
13+
14+ @NgModule ( {
15+ declarations : [
16+ TypeaheadComponent
17+ ] ,
18+ imports : [
19+ CommonModule ,
20+ FormsModule ,
21+ BsDropdownModule . forRoot ( ) ,
22+ TypeaheadModule . forRoot ( ) ,
23+ RouterModule . forChild ( TYPEAHEAD_ROUTES )
24+ ] ,
25+ providers : [
26+ TypeaheadService
27+ ]
28+ } )
29+ export class TypeaheadComponentModule {
30+ }
Original file line number Diff line number Diff line change 1+ export class TypeaheadService {
2+ public states = [
3+ 'A1' ,
4+ 'A2' ,
5+ 'A3' ,
6+ 'S1' ,
7+ 'S2' ,
8+ 'S3' ,
9+ 'Z1' ,
10+ 'Z2' ,
11+ 'Z3'
12+ ] ;
13+
14+ constructor ( ) {
15+ }
16+ }
You can’t perform that action at this time.
0 commit comments