Angular JS naming conventions ($, camelCase and PascalCase)

后端 未结 3 914
礼貌的吻别
礼貌的吻别 2020-12-15 17:08

What is the convention in AngularJS for prefixing providers with $? Should I prefix all custom services in my own code?

Looks like all things that come with angular

3条回答
  •  臣服心动
    2020-12-15 17:42

    The docs state this convention for internal services, but also state you should not do it for your own services to reduce naming collisions.

    http://docs.angularjs.org/guide/concepts#angular_namespace

    Also, regarding camelCase, the docs say to use camelCase.

    Angular uses name-with-dashes for attribute names and camelCase for the corresponding directive name

    http://docs.angularjs.org/tutorial/step_00

提交回复
热议问题