Angular JS naming conventions ($, camelCase and PascalCase)

后端 未结 3 910
礼貌的吻别
礼貌的吻别 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:52

    We can filter Text in CamelCase using following code 
     app.filter('camelCase', function(){
                var camelCaseFilter = function(input){
                        var words = input.split(' ');
                         for (var i = 0, len = words.length; i < len; i++)
                             words[i] = words[i].charAt( 0 ).toUpperCase() + words[i].slice(1);
                         return words.join(' ');
                     };
                     return camelCaseFilter;
            });
    

提交回复
热议问题