Skip to content

Commit

Permalink
fix(select): issue #437 (#454)
Browse files Browse the repository at this point in the history
* fix typing to input throwing an error and highlight on highlighting the first character

* added rest of the highlight pipe usages
  • Loading branch information
vixriihi authored and valorkin committed Oct 5, 2016
1 parent fa37202 commit 926e14d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions components/select/select-pipes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import { escapeRegexp } from './common';

@Pipe({name: 'highlight'})
export class HighlightPipe implements PipeTransform {
public transform(value:string, args:any[]):any {
if (args.length < 1) {
public transform(value:string, query:string):any {
if (query.length < 1) {
return value;
}

let query = args[0];

if ( query ) {
let tagRE = new RegExp('<[^<>]*>', 'ig');
// get ist of tags
Expand Down
8 changes: 4 additions & 4 deletions components/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ let styles = `
(mouseenter)="selectActive(o)"
(click)="selectMatch(o, $event)">
<a href="javascript:void(0)" class="dropdown-item">
<div [innerHtml]="sanitize(o.text) | highlight:inputValue"></div>
<div [innerHtml]="sanitize(o.text | highlight:inputValue)"></div>
</a>
</div>
</li>
Expand All @@ -162,7 +162,7 @@ let styles = `
(click)="selectMatch(o, $event)"
[ngClass]="{'active': isActive(o)}">
<a href="javascript:void(0)" class="dropdown-item">
<div [innerHtml]="sanitize(o.text) | highlight:inputValue"></div>
<div [innerHtml]="sanitize(o.text | highlight:inputValue)"></div>
</a>
</div>
</li>
Expand Down Expand Up @@ -209,7 +209,7 @@ let styles = `
(mouseenter)="selectActive(o)"
(click)="selectMatch(o, $event)">
<a href="javascript:void(0)" class="dropdown-item">
<div [innerHtml]="sanitize(o.text) | highlight:inputValue"></div>
<div [innerHtml]="sanitize(o.text | highlight:inputValue)"></div>
</a>
</div>
</li>
Expand All @@ -228,7 +228,7 @@ let styles = `
(click)="selectMatch(o, $event)"
[ngClass]="{'active': isActive(o)}">
<a href="javascript:void(0)" class="dropdown-item">
<div [innerHtml]="sanitize(o.text) | highlight:inputValue"></div>
<div [innerHtml]="sanitize(o.text | highlight:inputValue)"></div>
</a>
</div>
</li>
Expand Down

0 comments on commit 926e14d

Please sign in to comment.