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

Directive ngModel inside ui.materialize.ngModel module may affect the performance of whole application #216

Open
sampathLiyanage opened this issue Jan 27, 2017 · 1 comment

Comments

@sampathLiyanage
Copy link

sampathLiyanage commented Jan 27, 2017

In my app I used this library. When I profiled with chrome devtools, it showed 30% of the cpu time was taken by the code given below.

$timeout(function() {
    // To stop an infinite feedback-loop with material multiple-select.
    if (value instanceof Array && oldValue instanceof Array) {
        if (value.length == oldValue.length) {
            return;
        }
    }
    if (element.is('select')) {
        return;
    }
    // This fix is mainly to get placeholders to appear correctly, and it apparently screws things for the selects, so only doing this on something that isn't a select.
    if (value) {
        element.trigger("change");
    } else if (element.attr('placeholder') === undefined) {
        if (!element.is(":focus"))
            element.trigger("blur");
    }
});    

Apparently this has been added to fix a bug in multiple-select. Better if we find another approach as this affects the performance.

@sampathLiyanage sampathLiyanage changed the title Directive ngModel inside ui.materialize.ngModel may affect the performance of whole application that uses this library Directive ngModel inside ui.materialize.ngModel module may affect the performance of whole application Jan 27, 2017
@webbiesdk
Copy link
Collaborator

I agree, it is kind of an ugly fix. But the functionality is needed, so any change must preserve the current functionality.
Pull requests are welcome.

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

2 participants