Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
angular-bind-querystring
Advanced tools
Two way binding between scope variables and URL querystring with default values
Two way binding between scope variables and URL querystring with default values.
Angular is a peer-dependency of this project so you need to install it separately.
npm install --save angular-bind-querystring
bower install --save angular-bind-querystring
Add the dist/angular-bind-querystring.min.js
to your HTML file.
Add bindQuerystring
module as a dependency of your Angular app:
angular.module('yourModule', ['bindQuerystring']);
angular.module('yourModule').controller(function($scope, bindQuerystring) {
var target = {};
bindQuerystring({
target: target,
properties: ['foo']
});
});
Then every change on URL querystring or the target object (given the selected properties) will be reflected in both.
You can send a parser and/or a formatter function to handle the value serialization:
angular.module('yourModule').controller(function($scope, bindQuerystring) {
var target = {};
bindQuerystring({
target: target,
properties: ['foo'],
parser: function(value, property) {
// parse value from querystring to scope property
return parseInt(value);
},
formatter: function(value, property) {
// formats value from scope property to querystring
return '' + value;
}
});
});
Parsers and formatters receive the actual value and the name of the property being transformed.
target
- the object that holds the properties being boundproperties
- an array of strings naming the properties that should be boundscope
(optional) - isn't required, but prevents memory leak over timeparser
(optional) - function that converts the URL query string to your modelformatter
(optional) - function that converts your model to the URL query stringAny help is appreciated, feel free to open issues and submit pull requests.
FAQs
Two way binding between scope variables and URL querystring with default values
We found that angular-bind-querystring 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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.