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

Already on GitHub? Sign in to your account

Filters starting with "_" shouldn't be considered private #4842

Closed
gustavohenke opened this Issue Nov 8, 2013 · 14 comments

Comments

Projects
None yet
10 participants

Hey,

I've registered Underscore methods as filters, prefixing them with a _. Somewhat like this.

When I had my app running 1.2.0rc3, everything was fine, but today after updating to 1.2.0 they started to throw exceptions telling that I can't access private properties. I'm aware of this change as of 1.2.0, but I don't think filters should follow the same rule.

What could be done about this, any tip/workaround...?

+1 - CouchDB uses a convention where each document id and revision is prefixed with an underscore. Example:

{
    _id: "myDocumentId",
    _rev: "myDocumentRevision"
}

This addition of underscore-as-private makes it impossible to use ngResource and CouchDB.

tortlieb commented Nov 8, 2013

This "error" should be something people do in best practice, and not something that causes your application to fail. Javascript allows me to name my variables anything; don't force your private member variable naming convention on me. How was this not put in any of the release candidates, as this is a code-breaking change?

@krotscheck this would affect MongoDB users aswell

devony commented Nov 8, 2013

+1 it seems like rc3 files were removed from bower as well so we can't go back

tortlieb commented Nov 9, 2013

I was able to go back to "angular": "1.2.0-rc.3"

devony commented Nov 9, 2013

ahh you're right my resolves were not pointing where i expected

lucsky commented Nov 9, 2013

This is most stupid change I've seen in 1.2.

MongoDB and CouchDB use "_id" fields and a few REST APIs that I use allow to embed linked data and return it in an "_embedded" property, to name a few examples of why this should either be reverted alltogether or given a way to be disabled.

leisms commented Nov 9, 2013

See #4509 for the main discussion

goya commented Nov 10, 2013

how to repro this issue: use couch or mongo with angular. the outright ridiculousness of this breaking change is beyond belief, i feel we are just being trolled.

@goya Actually, the problem I've reported is different from the one you guys are reporting.
However, I agree that this should have been done in a RC, so we could have approved/disapproved it before it made into in a final release.

@chirayuk chirayuk was assigned Nov 11, 2013

+1 this is a big problem with mongoDB. need to use RC3 until this is fixed or all my apps break.

+1 ditto with MongoDB.

goya commented Nov 13, 2013

fixed in 1.2.1 by #4926 which just added some more bloat.

Guys... please... this is a issue for NOT considering filters as private.
You should complain about MongoDB/CouchDB issues in #4859 or #4509.

@vojtajina vojtajina closed this in 4ab16aa Nov 14, 2013

@jamesdaily jamesdaily added a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014

@vojtajina @jamesdaily vojtajina + jamesdaily feat($parse): revert hiding "private" properties
Hiding `_*` properties was a feature primarily for developers using Closure compiler and Google JS
style. We didn't realize how many people will be affected by this change.

We might introduce this feature in the future, probably under a config option, but it needs more
research and so I'm reverting the change for now.

This reverts commit 3d6a89e.

Closes #4926
Closes #4842
Closes #4865
Closes #4859
Closes #4849

Conflicts:
	src/ng/parse.js
22d7915

@jamesdaily jamesdaily added a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014

@vojtajina @jamesdaily vojtajina + jamesdaily feat($parse): revert hiding "private" properties
Hiding `_*` properties was a feature primarily for developers using Closure compiler and Google JS
style. We didn't realize how many people will be affected by this change.

We might introduce this feature in the future, probably under a config option, but it needs more
research and so I'm reverting the change for now.

This reverts commit 3d6a89e.

Closes #4926
Closes #4842
Closes #4865
Closes #4859
Closes #4849

Conflicts:
	src/ng/parse.js
8d4f667
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment