Skip to content

Commit

Permalink
Safari bug causing error. Replacing [style] with [ngStyle]
Browse files Browse the repository at this point in the history
fixes #90
fixes #95
  • Loading branch information
softsimon committed Mar 14, 2017
1 parent ba7d83e commit e16c7cf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/multiselect-dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, NG_VALUE_ACCESSOR, ControlValueAccessor, Validator, AbstractControl } from '@angular/forms';
import { DomSanitizer } from '@angular/platform-browser';

const MULTISELECT_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
Expand Down Expand Up @@ -122,7 +121,7 @@ export class MultiSelectSearchFilter implements PipeTransform {
</a>
</li>
<li *ngIf="settings.showCheckAll || settings.showUncheckAll" class="dropdown-divider divider"></li>
<li class="dropdown-item" [style]="!option.isLabel && cursorpointer" *ngFor="let option of options | searchFilter:searchFilterText"
<li class="dropdown-item" [ngStyle]="getItemStyle(option)" *ngFor="let option of options | searchFilter:searchFilterText"
(click)="!option.isLabel && setSelected($event, option)" [class.dropdown-header]="option.isLabel">
<template [ngIf]="option.isLabel">
{{ option.name }}
Expand Down Expand Up @@ -175,7 +174,6 @@ export class MultiselectDropdown implements OnInit, DoCheck, ControlValueAccesso
numSelected: number = 0;
isVisible: boolean = false;
searchFilterText: string = '';
cursorPointer = this.sanitizer.bypassSecurityTrustStyle('cursor: pointer');

defaultSettings: IMultiSelectSettings = {
pullRight: false,
Expand All @@ -201,11 +199,16 @@ export class MultiselectDropdown implements OnInit, DoCheck, ControlValueAccesso
};

constructor(private element: ElementRef,
private sanitizer: DomSanitizer,
differs: IterableDiffers) {
this.differ = differs.find([]).create(null);
}

getItemStyle(option: IMultiSelectOption): any {
if (!option.isLabel) {
return {'cursor': 'pointer'};
}
}

ngOnInit() {
this.settings = Object.assign(this.defaultSettings, this.settings);
this.texts = Object.assign(this.defaultTexts, this.texts);
Expand Down

0 comments on commit e16c7cf

Please sign in to comment.