hoeni
hoeni

Reputation: 3290

Use dollar sign prefixed property names (obj.$myprop) throughout AngularJS?

I'll have to work on a dataset with a given structure that contains elements with dollar signs in their property names: foo$bar oder even in the beginning like $bar. There will be no double dollar sign in the beginning of a property name like $$forbidden.

I am aware that $$-properties are dropped/ignored on several places throughout Angular and the use of $-prefixed names is discouraged for dependency injection.

Is it safe to use these property names in my data-model, though? Which parts of AngularJS may be critical? How much pain am I to expect from future AngularJS updates?

Upvotes: 0

Views: 108

Answers (1)

Petr Averyanov
Petr Averyanov

Reputation: 9486

First, I dont think you may face some real issues with single $ right now.

But this is not good, so if i.e. you are getting dataset from some API call - just add functions to trasform reqest/response to remove all dollars and transformResponse to add them where needed.

Upvotes: 2

Related Questions