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

Unable to use controllerAs syntax on controls attribute #348

Closed
Raptormstr opened this issue Apr 2, 2014 · 5 comments
Closed

Unable to use controllerAs syntax on controls attribute #348

Raptormstr opened this issue Apr 2, 2014 · 5 comments

Comments

@Raptormstr
Copy link

jQuery considers the attribute "controls" as a reserved word and will rename any string to simple "controls". Look at the jQuery.js source code lines 623 & 6888 for 2.1.0 and 665 & 7960 for 1.11.0. I do not believe jqLite has this same issue.

For example:
Before $compile:
After $compile:

NOTE: I removed the other attributes and classes for brevity.

The only workaround if jQuery is required is to use the variable name "controls" and assign it to the $scope.

@tombatossals
Copy link
Owner

You're right, good point.

What would you suggest to solve this? Rename the attribute, like "lfControls", for example?

@Raptormstr
Copy link
Author

I believe renaming the attribute is the only option. Since Angular will
execute the jQuery code long before this directive, there is no way to
intervene. Also, "controls" is an HTML5 attribute for audio and video so
it should not be used at all.

As for your namespace suggestion, that would work but it should be applied
to all the attributes for consistency.

Stephen
On Apr 2, 2014 1:03 PM, "David Rubert" notifications@github.com wrote:

You're right, good point.

What would you suggest to solve this? Rename the attribute, like
"lfControls", for example?

Reply to this email directly or view it on GitHubhttps://github.com//issues/348#issuecomment-39356110
.

@jsthivierge
Copy link

Got a similar problem. I used grunt-contrib-htmlmin task to minimize my html and since controls is a HTML5 attribute and my scope variable is named controls (<leaflet controls="controls"></leaflet>), it got renamed to <leaflet controls></leaflet>.

The htmlmin task option collapseBooleanAttributes was set to true, therefore controls="controls" was collapsed to controls since it's an html5 attribute...

Any idea if the attributes will be renamed soon to prevent this type of conflict?

@nmccready
Copy link
Contributor

This issue was moved to angular-ui/ui-leaflet#18

@tombatossals
Copy link
Owner

I'm going to rework&redesign angular-leaflet-directive to be compatible with Leaflet v1.0. It will mantain almost all its functionality, and will be compatible with the current features of the directive, but I must start from a fresh point, so I'm going to close this issue. If you think it must be worked with the new version, please reopen it.

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

4 participants