0
How to create a date formatting Month/A
I developed as code below, and it is not going through the console menus, IE, is not entering the link:
Note: there is no error in the console.
<div class="form-group">
<label class="control-label">Faz aniversário entre (Mês/Ano)</label>
<div class="row">
<div class=" col-sm-7">
<div class="input-group">
<span class="input-group-addon"><i class="material-icons">today</i></span>
<input class="form-control" ng-model="state.filtro.dataInicialAniversario" placeholder="de" formatDateMesAno />
</div>
</div>
<div class="col-sm-5">
<input class="form-control" ng-model="state.filtro.dataFinalAniversario" placeholder="até" formatDateMesAno />
</div>
</div>
</div>
angular.module("app").directive('formatDateMesAno', directiveFormatMesAno);
function directiveFormatMesAno() {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, elem, attr, modelCtrl) {
console.log(scope);
console.log(elem);
console.log(attr);
console.log(modelCtrl);
}
};
That’s right, I didn’t mind when I used the copy and glue.. Could help me, what would be the best way to create a directive to format a month year date ?
– Nicola Bogar
i particularly always used ready-made solutions, but I will edit the answer with something specific for dates.
– Felipe Duarte