
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
angular-auto-save-form
Advanced tools
Angular auto save form changed inputs.
The directive will call the callback function with a parameter object containing only the inputs that are $dirty.
bower install angular-auto-save-form --save
npm install angular-auto-save-form --save
Then add a <script>
to your index.html
:
<link rel="stylesheet" href="bower_components/angular-auto-save-form/dist/auto-save-form.css">
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/lodash/lodash.js"></script>
<script src="bower_components/angular-auto-save-form/dist/auto-save-form.js"></script>
Include 'angular-auto-save-form' as a dependency of your module like this:
var module = angular.module("example", ["angular-auto-save-form"]);
Directive requires that form and input elements to have [name] attribute
<ng-form name="myForm" auto-save-form="callback(controls)">
<input ng-model="user.name" name="name"/>
<input ng-model="user.email" name="email"/>
</ng-form>
Which expects a scope setup like the following:
$scope.user = { name: "Jon Doe", email: "jon.doe@domain.com" };
//changing input user.name the callback function will be called with parameter object
$scope.callback = function(controls){ // controls = {'name': 'Jon Doe'}
return $http.post('saveDataUrl', controls);
};
For radio inputs or if you want to group inputs on the same property use the [auto-save-form-property] attribute
on one of the inputs and prefix the input name with a group name
<ng-form name="myForm" auto-save-form="callback(controls)">
<input type="radio" ng-model="user.gender" name="inputGroupName.gender1"
auto-save-form-property="inputGroupName.gender" value="male"/>Male
<input type="radio" ng-model="user.gender" name="inputGroupName.gender2" value="female"/>Female
</ng-form>
The object will look like this:
//{'gender': 'male'}
If you want to change locally debounce timer
auto-save-form-debounce="number" default:500
If you want to change the debounce at input level use [ng-model-options] directive
Loading spinner in top right corner of the form enabled by default if callback promise returns a promise.
auto-save-form-spinner="boolean" default:true
auto-save-form-spinner-position="string" default:'top right'
Possible combinations: 'top right', 'top left', 'bottom left', 'bottom right'.
It is possible to add your own class without your desired position.
Example:
[auto-save-form] .spinner.my-class {
top: 50%;
left: 50%;
}
auto-save-form-spinner-position="my-class"
user = {
name: 'Jon Doe',
country: {
name: 'French',
city: 'Paris'
}
}
<input ng-model="user.country.name" name="country.name"/>
//callback object
{
country: {
name: 'French'
}
}
<form name="myForm" auto-save-form="callback(controls, $event)" auto-save-form-mode="boolean">
<input ng-model="username" name="user"/>
</form>
Which expects a scope setup like the following:
$scope.username = "Jon Doe";
$scope.callback = function(controls, $event){ // controls = {'user': 'Jon Doe'}, $event={formSubmitEvent}
$http.post('saveDataUrl', controls);
};
It is optional if the property is set to false globally
auto-save-form-mode="boolean"
$scope.autoSaveFormSubmit($event);
In config phase add autoSaveFormProvider
autoSaveFormProvider.setDebounce(500); //change globaly default debounce timer
autoSaveFormProvider.setAutoSaveMode(true); //change globaly default auto save mode
autoSaveFormProvider.setSpinner(true); //change globaly default spinner
autoSaveFormProvider.setSpinnerPosition('top right'); //change globaly default position of the spinner
The MIT License
Copyright (c) 2017 Tiberiu Zuld
FAQs
Angular auto save form changed inputs
We found that angular-auto-save-form 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 researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.