From 875e71b12de009f41c44e2d242823f5b8981957d Mon Sep 17 00:00:00 2001 From: Abhas Bhattacharya Date: Sat, 18 Mar 2017 08:42:42 +0530 Subject: [PATCH] Added filter for sentencecase --- index.html | 3 ++- js/app.js | 2 +- js/filters.js | 10 ++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 js/filters.js diff --git a/index.html b/index.html index 1b45e36..e9e381c 100644 --- a/index.html +++ b/index.html @@ -53,7 +53,7 @@
- +
@@ -65,6 +65,7 @@ + \ No newline at end of file diff --git a/js/app.js b/js/app.js index ccd1700..6ed84e0 100644 --- a/js/app.js +++ b/js/app.js @@ -1,4 +1,4 @@ -var app = angular.module("chart-builder",["ngDrag"]); +var app = angular.module("chart-builder",["ngDrag","chart-builder.filters"]); app.value("allData",{ "values":{ diff --git a/js/filters.js b/js/filters.js new file mode 100644 index 0000000..82b3916 --- /dev/null +++ b/js/filters.js @@ -0,0 +1,10 @@ +var app = angular.module("chart-builder.filters",[]); + +app.filter("sentencecase", function () { + return function (strToUse) { + if (typeof(strToUse) === "string"){ + strToUse = strToUse[0].toUpperCase() + strToUse.slice(1); + } + return strToUse; + }; +}); \ No newline at end of file