Created
October 10, 2019 10:49
-
-
Save guaracyalima/971a6fa7d7d572b3a1a42b5e34a8b3b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> | |
<body> | |
<script> | |
var app = angular.module("myShoppingList", []); | |
app.controller("myCtrl", function ($scope) { | |
$scope.data1 = '06.09.2019'; | |
$scope.data2 = '2019-09-03-12.22.10.484160'; | |
$scope.products = ["Milk", "Bread", "Cheese"]; | |
$scope.addItem = function () { | |
$scope.products.push($scope.addMe); | |
} | |
$scope.removeItem = function (x) { | |
$scope.products.splice(x, 1); | |
} | |
}); | |
app.filter('dataComTimestamps', function () { | |
return function (input) { | |
var ano = input.substring(0, 4); | |
var mes = input.substring(5, 7); | |
var dia = input.substring(8, 10); | |
var dataFormatada = dia + '/' + mes + '/' + ano; | |
return dataFormatada; | |
} | |
}) | |
app.filter('asDataComPontos', function () { | |
return function (input) { | |
input = input.replace('.', '/'); | |
input = input.replace('.', '/'); | |
console.log(input); | |
return input; | |
} | |
}); | |
</script> | |
<div ng-app="myShoppingList" ng-controller="myCtrl"> | |
<br> | |
<h1>{{ data1 | asDataComPontos }}</h1> | |
<br> | |
<h2>{{ data2 | dataComTimestamps }}</h2> | |
<br> | |
<br> | |
<br> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment