angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

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

Open gustavohenke opened this issue 13 years ago • 14 comments

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...?

gustavohenke avatar Nov 08 '13 22:11 gustavohenke

+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.

krotscheck avatar Nov 08 '13 22:11 krotscheck

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?

tortlieb avatar Nov 08 '13 22:11 tortlieb

@krotscheck this would affect MongoDB users aswell

gustavohenke avatar Nov 08 '13 22:11 gustavohenke

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

devony avatar Nov 08 '13 23:11 devony

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

tortlieb avatar Nov 09 '13 00:11 tortlieb

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

devony avatar Nov 09 '13 00:11 devony

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.

lucsky avatar Nov 09 '13 16:11 lucsky

See https://github.com/angular/angular.js/pull/4509 for the main discussion

lezhangxyz avatar Nov 09 '13 19:11 lezhangxyz

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 avatar Nov 10 '13 21:11 goya

@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.

gustavohenke avatar Nov 10 '13 23:11 gustavohenke

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

christrude avatar Nov 13 '13 19:11 christrude

+1 ditto with MongoDB.

gwbarrett avatar Nov 13 '13 20:11 gwbarrett

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

goya avatar Nov 13 '13 21:11 goya

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

gustavohenke avatar Nov 13 '13 21:11 gustavohenke