Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@dmoz/ng-pickadate
Advanced tools
AngularJS directives for pickadate.js.
http://toilal.github.io/ng-pickadate/
Install dependency using bower
bower install ng-pickadate --save
Set overrides
property in bower.json to register pickadate CSS files
Classic theme
"overrides": {
"pickadate": {
"main": [
"lib/picker.js",
"lib/picker.date.js",
"lib/picker.time.js",
"lib/themes/classic.css",
"lib/themes/classic.date.css",
"lib/themes/classic.time.css"
]
}
}
Default theme
"overrides": {
"pickadate": {
"main": [
"lib/picker.js",
"lib/picker.date.js",
"lib/picker.time.js",
"lib/themes/default.css",
"lib/themes/default.date.css",
"lib/themes/default.time.css"
]
}
}
Declare the dependency
angular.module('yourApp', ['pickadate']);
Use pick-a-date
and pick-a-time
directives.
<input type="text" pick-a-date="curDate"/>
<input type="text" pick-a-time="curTime"/>
$scope.curDate = new Date(); // Only the date part of curDate
// is synced to pick-a-date directive
$scope.curTime = new Date(); // Only the time part of timeDate
// is synced to pick-a-time directive
You can also provide additional max-date
and min-date
values.
<input type="text" pick-a-date="startDate" max-date="endDate"/>
<input type="text" pick-a-date="endDate" min-date="startDate"/>
You can define pickadate.js options through pick-a-date-options
and
pick-a-time-options
directives as well.
<input type="text" pick-a-date="curDate" pick-a-date-options="{ format: 'dd/mm/yy', selectYears: true }" />
If you find yourself setting the same options for multiple date pickers, you can set them as the default options for
all date pickers by configuring pickADateProvider
and pickATimeProvider
.
angular.module('yourApp', ['pickadate'])
.config(['pickADateProvider', 'pickATimeProvider', function (pickADateProvider, pickATimeProvider) {
pickADateProvider.setOptions({
format: 'dd/mm/yy',
selectYears: true
});
pickATimeProvider.setOptions({
today: ''
});
}]);
AngularJS form validation can be used using ngModel
. Keep in mind that
ngModel
keeps the string value of the raw input.
<form name="dateForm">
<input type="text" name="dateInput" ng-model="curDateText" pick-a-date="curDate"/>
<div ng-show="dateForm.dateInput.$error.required" style="color: red;">
<strong>Date is required.</strong>
</div>
</form>
In order to correct how the pickadate.js affects ngModel
states of its assigned input, ng-pickadate uses
ngModelController
to manually restore expected form validation states: $pristine
, $dirty
, $untouched
,
and $touched
. The unexpected angular validation states caused by the pickadate.js jQuery plugin, and how they've been
corrected, are as follows:
ngModel
to be marked as $dirty
. To correct
this, the ng-pickadate directives each set ngModel
to $pristine
at the end of the postlink
function.ngModel
is marked as $touched
.
To correct this, the directives set ngModel
to $untouched
the first time the calendar opens, and set it to
$touched
whenever the calendar closes, via pickadate's onOpen
and onClose
methods, respectively.This project is initially based on a blog post from Coding Insight
FAQs
AngularJS directives for pickadate.js
The npm package @dmoz/ng-pickadate receives a total of 14 weekly downloads. As such, @dmoz/ng-pickadate popularity was classified as not popular.
We found that @dmoz/ng-pickadate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.