Filters for convert text to camel case in Angular Js

angularjs
camelcase
filters

By using filters convert text to camel case.

angular.module('test')
.filter('TextCamelCase', function() {
  return function(input) {
    input = input || '';
    return input.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
  };
});

 

You might also like:

Functions in javascript

25-05-2018 functions javascript es5 es6 arrow functions named functions Closures Nested Functions Callbacks Arrow functions.

Example for Conditional Operator in php

16-04-2017 php Conditional Operator example

Get next date from given date in javascript

06-03-2017 date javascript next date

Filter for change Date format (MM-dd-yyyy) in Angular Js

05-03-2017 mm-dd-yyyy date formats angular js

How to change background color and color to the text using javascript

27-02-2017 css javascript colors