Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select multiple - search in items : error value.match is not a function (due to SafeHtmlImpl) #438

Closed
jcs13 opened this issue Sep 22, 2016 · 17 comments

Comments

@jcs13
Copy link

jcs13 commented Sep 22, 2016

Hello

In "select multiple", when you search an items (input text), I've an error :

EXCEPTION: Error in ./SelectComponent class SelectComponent - inline template:106:19 caused by: t.match is not a function

(Chrome & FF + Angular Final 2.0.0)
Same issue with your demo.

The error is into the HighlightPipe : var tagList = value.match(tagRE); due to value is not a string but instance of SafeHtmlImpl

I don't known if it's the best soltuion, but you could fix it with :

        if (value instanceof SafeHtmlImpl) {
            value = value.changingThisBreaksApplicationSecurity;
        }

thkx

@alpeshv
Copy link

alpeshv commented Sep 22, 2016

Not sure how you will get hold of SafeHtmlImpl. But I am using it locally with the following fix.

public transform(safeHtml:any, args:any[]):any {            
    var value = safeHtml.changingThisBreaksApplicationSecurity;
    ...
}

@theunreal
Copy link

Same as #437

@theunreal
Copy link

@alpeshv Where did you place /replace this line with?

@alpeshv
Copy link

alpeshv commented Sep 23, 2016

@theunreal Inside select-pipes.ts, changing signature of transform method and adding one line inside it at the top. Rest will remain same.

@Scipionh
Copy link

I can't highlight enough, how important it is to fix this asap.

@GuillaumeDK57
Copy link

+1
Typing filter throws exception :

myExceptionHandler.service.ts:15 Stack : TypeError: value.match is not a function

at HighlightPipe.transform (http://127.0.0.1:9000/assets/lib/ng2-select/components/select/select-pipes.js:15:33)
at eval (http://127.0.0.1:9000/assets/lib/angular__core/src/linker/view_utils.js!transpiled:120:26)
at DebugAppView._View_SelectComponent8.detectChangesInternal (SelectComponent.ngfactory.js:821:136)
at DebugAppView.AppView.detectChanges (http://127.0.0.1:9000/assets/lib/angular__core/src/linker/view.js!transpiled:334:26)
at DebugAppView.detectChanges (http://127.0.0.1:9000/assets/lib/angular__core/src/linker/view.js!transpiled:439:56)
at DebugAppView.AppView.detectContentChildrenChanges (http://127.0.0.1:9000/assets/lib/angular__core/src/linker/view.js!transpiled:352:31)
at DebugAppView._View_SelectComponent7.detectChangesInternal (SelectComponent.ngfactory.js:745:8)
at DebugAppView.AppView.detectChanges (http://127.0.0.1:9000/assets/lib/angular__core/src/linker/view.js!transpiled:334:26)
at DebugAppView.detectChanges (http://127.0.0.1:9000/assets/lib/angular__core/src/linker/view.js!transpiled:439:56)
at DebugAppView.AppView.detectContentChildrenChanges (http://127.0.0.1:9000/assets/lib/angular__core/src/linker/view.js!transpiled:352:31)

@theunreal
Copy link

theunreal commented Sep 24, 2016

@alpeshv Changing select-pipes.d.ts with the following code:

import { PipeTransform } from '@angular/core';
export declare class HighlightPipe implements PipeTransform {
    public transform(safeHtml:any, args:any[]):any {            
    var value = safeHtml.changingThisBreaksApplicationSecurity;
    }
}
export declare function stripTags(input: string): string;

don't update anything in the app, only when updating the JS files. I guess I need to re-build the package, how I can do that?

@alpeshv
Copy link

alpeshv commented Sep 24, 2016

@theunreal I have not tried to change npm package directly inside my project yet but you shouldn't be changing them anyway. You should download and include select.module.ts in your project and all the related .ts files which are in the 'select' folder instead of downloading it using npm and change references accordingly. If your project is a ts project then your ts files are being transpiled into js files using tsc command somewhere. Anyway select2 is not stable at all. idField and textField properties are also not fully working. I had to fix them myself.

@Scipionh
Copy link

Scipionh commented Oct 3, 2016

Any news on this ?

@alexjeen
Copy link

alexjeen commented Oct 4, 2016

+1 having the same problem

@jppellerin
Copy link

+1

2 similar comments
@faizan-ali
Copy link

+1

@yobud
Copy link

yobud commented Oct 14, 2016

+1

@alexjeen
Copy link

alexjeen commented Oct 15, 2016

This is taking too long, it's blocking a project of ours. Can somebody make a PR to fix this? Maybe @alpeshv as you've already seemed to fix this?

@alpeshv
Copy link

alpeshv commented Oct 17, 2016

@alexjeen I don't have permission to make a PR on this repo unfortunately. Anyway there are so many PRs pending. There are also issues with id and value fields. You will be better off copying the code and make changes locally. They have done nice work upfront but allowed bugs being merged recently.

@alexjeen
Copy link

We've switched to a jQuery implementation so it's not needed anymore.

@jcs13 jcs13 closed this as completed Nov 14, 2016
@jcs13
Copy link
Author

jcs13 commented Nov 14, 2016

FIX with 1.1.1 :
select: issue #437 (#454) (926e14d)

Thanks :) !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants