Git Product home page Git Product logo

Comments (8)

isteven avatar isteven commented on July 21, 2024

hi @ozairabbas ,

May I know which minifier did you use? Have you tried to use http://jscompress.com?

from angular-multi-select.

msepahvand avatar msepahvand commented on July 21, 2024

I just ran into the same problem, I'm using the ASP.NET web optimizations minification and bundling package (MVC5), I've included dozens of other angular libraries and they all seem to work fine, keeps giving an error on 'prevTabIndex', any ideas? Just skimming through thr code for thr directive it seems to be written minification safe.

from angular-multi-select.

msepahvand avatar msepahvand commented on July 21, 2024

This is peculiar, I just ran a small test with the same asp.net minifier and everything worked fine, I'll take another look at it when I get home.

from angular-multi-select.

isteven avatar isteven commented on July 21, 2024

I've manually checked the code.. looks ok to me. I suggest to minify it manually if possible.

Btw make sure that you get the latest version.

from angular-multi-select.

rockstardev avatar rockstardev commented on July 21, 2024

Just to add that I'm also using ASP.NET minification (System.Web.Optimization) and I have 0 problems with this component. It's probably some of the JS components that you are using that's causing the problem - I've had quite few issues when combining Jquery, angular and different angular components in single bundles (some just don't play nicely with each other).

from angular-multi-select.

msepahvand avatar msepahvand commented on July 21, 2024

There IS a slight problem though, I just figured it out. I was bundling this directive along with my own scripts, and I always code in <strict mode>, that in combination with some poor formatting in the directive code was making the bundler unhappy, inspecting the network request for the bundle I noticed this:

Minification failed. Returning unminified contents.
(760,25-37): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: prevTabIndex
(756,21-33): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: prevTabIndex
(777,25-37): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: prevTabIndex
(773,21-33): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: prevTabIndex
(738,21-24): run-time error JS1294: Strict-mode does not allow ++ or -- on certain objects: ctr
(735,17-20): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: ctr
(710,13-28): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: genRandomString
(694,33-37): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: temp
(669,17-28): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: helperIndex
(634,17-27): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: targetsArr
(614,25-42): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: helperItemsLength
(611,31-32): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: i
(611,100-101): run-time error JS1294: Strict-mode does not allow ++ or -- on certain objects: i
(596,21-38): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: helperItemsLength
(595,21-32): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: helperItems
(551,17-26): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: clickedEl
(492,29-32): run-time error JS1294: Strict-mode does not allow ++ or -- on certain objects: ctr
(466,17-20): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: ctr
(424,17-29): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: prevTabIndex
(349,49-64): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: inputModelIndex
(355,49-64): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: inputModelIndex
(368,49-64): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: inputModelIndex
(375,49-64): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: inputModelIndex
(417,21-36): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: inputModelIndex
(290,17-22): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: index
(135,13-30): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: helperItemsLength
(134,13-24): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: helperItems
(133,13-25): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: prevTabIndex

The code is riddled with implicitly defined variables, Tbh I personally never understood this practice, I mean your code will most probably work fine but Jesus it will look hideous. Inspecting the JsHint warnings in Visual Studio gives you more of an insight, for example:
<Assignment to an implictly declared global variable genRandomString>.

In my case the 2 workarounds were:

  1. Stop using <strict-mode>.
  2. Clean up the few global variables, and scoping issues.

I opted the latter, only took about 5/6 minutes thanks to JsHint.

HTH.

from angular-multi-select.

isteven avatar isteven commented on July 21, 2024

Hi @ElDuderino87 ,

Thanks for pointing this out. Will consider using strict mode for the next release.

from angular-multi-select.

msepahvand avatar msepahvand commented on July 21, 2024

@isteven You're most welcome. Thank you for the awesome directive :).

from angular-multi-select.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.