Templarian / ui.bootstrap.contextMenu

AngularJS Bootstrap UI Context Menu
MIT License
259 stars 127 forks source link

fix: update initialization of $ correctly #58

Open josetaira opened 8 years ago

josetaira commented 8 years ago

Fix issue where $ is not initialized properly. Assuming it must always be initialized to angular.element.

josetaira commented 8 years ago

@Templarian if you can quickly take a look at this. The assumption is that $ should be initialized to angular.element. Instead of initializing it later, we pass it as a parameter in the anonymous function call. I also wrapped everything around a function call so that it'd be easier to uglify and concatenate with.

Templarian commented 8 years ago

I did that to keep from wrapping the entire module. You could probably do this with a simple provider...

.value('AngularElement', angular.element) then just inject it ['AngularElement', $]. Didn't test this idea, but I think it should work?

https://github.com/angular-ui/bootstrap/tree/master/src Was looking through to see how they do it here... but they just use angular.element everywhere.

josetaira commented 8 years ago

It might be better to just use angular.element everything. But I prefer to keep the anonymous function call to ensure that projects that merge this code with other codes will work as expected when concatenated and/or uglified.