taskApp.directive('backButton', function ($location) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.on('click', function () {
$location.path('/');
scope.$apply();
});
}
};
});
function isValidJSON(src) {
var filtered = src;
filtered = filtered.replace(/\\["\\\/bfnrtu]/g, '@');
filtered = filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']');
filtered = filtered.replace(/(?:^|:|,)(?:\s*\[)+/g, '');
return (/^[\],:{}\s]*$/.test(filtered));
};