Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

e.g. I'm unsure when it's common to prefix variables with a $

A quick Google and I found a StackOverflow thread about this,

The accepted answeraccepted answer had this to say:

It's a common reference to a jQuery wrapped object. It makes reading the code easier to know which variables are jQuery wrapped.

I would say that you don't need to use $ prefix in your code at all, at least what you have posted.


If you were using $scope that would be different as noted by this answerthis answer

$scope variables bind to the view where as var does not and is local to the function it was declared in!


also noted in the comments

The $ prefix is used as a naming convention identifying native AngularJS services

▼▼▼

Do not use $ to prepend your own object properties and service identifiers. Consider this style of naming reserved by AngularJS and jQuery.

From Google's AngularJS Style Guide

e.g. I'm unsure when it's common to prefix variables with a $

A quick Google and I found a StackOverflow thread about this,

The accepted answer had this to say:

It's a common reference to a jQuery wrapped object. It makes reading the code easier to know which variables are jQuery wrapped.

I would say that you don't need to use $ prefix in your code at all, at least what you have posted.


If you were using $scope that would be different as noted by this answer

$scope variables bind to the view where as var does not and is local to the function it was declared in!


also noted in the comments

The $ prefix is used as a naming convention identifying native AngularJS services

▼▼▼

Do not use $ to prepend your own object properties and service identifiers. Consider this style of naming reserved by AngularJS and jQuery.

From Google's AngularJS Style Guide

e.g. I'm unsure when it's common to prefix variables with a $

A quick Google and I found a StackOverflow thread about this,

The accepted answer had this to say:

It's a common reference to a jQuery wrapped object. It makes reading the code easier to know which variables are jQuery wrapped.

I would say that you don't need to use $ prefix in your code at all, at least what you have posted.


If you were using $scope that would be different as noted by this answer

$scope variables bind to the view where as var does not and is local to the function it was declared in!


also noted in the comments

The $ prefix is used as a naming convention identifying native AngularJS services

▼▼▼

Do not use $ to prepend your own object properties and service identifiers. Consider this style of naming reserved by AngularJS and jQuery.

From Google's AngularJS Style Guide

Bounty Ended with 50 reputation awarded by Jeroen
added information from a comment-er, thanks [Greg Burghardt](http://codereview.stackexchange.com/users/47364/greg-burghardt)
Source Link
Malachi
  • 28.7k
  • 11
  • 86
  • 188

e.g. I'm unsure when it's common to prefix variables with a $

A quick Google and I found a StackOverflow thread about this,

The accepted answer had this to say:

It's a common reference to a jQuery wrapped object. It makes reading the code easier to know which variables are jQuery wrapped.

I would say that you don't need to use $ prefix in your code at all, at least what you have posted.


If you were using $scope that would be different as noted by this answer

$scope variables bind to the view where as var does not and is local to the function it was declared in!


also noted in the comments

The $ prefix is used as a naming convention identifying native AngularJS services

▼▼▼

Do not use $ to prepend your own object properties and service identifiers. Consider this style of naming reserved by AngularJS and jQuery.

From Google's AngularJS Style Guide

e.g. I'm unsure when it's common to prefix variables with a $

A quick Google and I found a StackOverflow thread about this,

The accepted answer had this to say:

It's a common reference to a jQuery wrapped object. It makes reading the code easier to know which variables are jQuery wrapped.

I would say that you don't need to use $ prefix in your code at all, at least what you have posted.


If you were using $scope that would be different as noted by this answer

$scope variables bind to the view where as var does not and is local to the function it was declared in!

e.g. I'm unsure when it's common to prefix variables with a $

A quick Google and I found a StackOverflow thread about this,

The accepted answer had this to say:

It's a common reference to a jQuery wrapped object. It makes reading the code easier to know which variables are jQuery wrapped.

I would say that you don't need to use $ prefix in your code at all, at least what you have posted.


If you were using $scope that would be different as noted by this answer

$scope variables bind to the view where as var does not and is local to the function it was declared in!


also noted in the comments

The $ prefix is used as a naming convention identifying native AngularJS services

▼▼▼

Do not use $ to prepend your own object properties and service identifiers. Consider this style of naming reserved by AngularJS and jQuery.

From Google's AngularJS Style Guide

added 101 characters in body
Source Link
Malachi
  • 28.7k
  • 11
  • 86
  • 188

e.g. I'm unsure when it's common to prefix variables with a $

A quick Google and I found a StackOverflow thread about this,

The accepted answer had this to say:

It's a common reference to a jQuery wrapped object. It makes reading the code easier to know which variables are jQuery wrapped.

I would say that you don't need to use $ prefix in your code at all, at least what you have posted.


If you were using $scope that would be different as noted by this answer

$scope variables bind to the view where as var does not and is local to the function it was declared in!

e.g. I'm unsure when it's common to prefix variables with a $

A quick Google and I found a StackOverflow thread about this,

The accepted answer had this to say:

It's a common reference to a jQuery wrapped object. It makes reading the code easier to know which variables are jQuery wrapped.

e.g. I'm unsure when it's common to prefix variables with a $

A quick Google and I found a StackOverflow thread about this,

The accepted answer had this to say:

It's a common reference to a jQuery wrapped object. It makes reading the code easier to know which variables are jQuery wrapped.

I would say that you don't need to use $ prefix in your code at all, at least what you have posted.


If you were using $scope that would be different as noted by this answer

$scope variables bind to the view where as var does not and is local to the function it was declared in!

Source Link
Malachi
  • 28.7k
  • 11
  • 86
  • 188
Loading