npm

Need private packages and team management tools?Check out npm Orgs. »

ngx-url

2.1.0 • Public • Published

NgxUrl

NgxUrl is an Angular library for dealing with url in a more convenient way. It allows easy access to particular parts of the url. It also provides tracking of url changes, so that it is easy to compare current and previous urls.

Installation

NPM:

npm install ngx-url

Yarn:

yarn add ngx-url

Usage

Use Url as any other service:

import {Url} from 'ngx-url'; 
 
class Component {
  constructor(private url: Url) { }
}

With Url service you are able to:

  • create a url state containing handy properties
const urlState = this.url.createState('some/url/');
  • subscribe to url changes that are updated on every navigation
this.url.changes$.subscribe(({current, previous}: UrlChanges) => {
  // do your stuff
});
  • get recently updated url changes without subscribing
const changes = this.url.changesValue;

Issues

If you find any issue or have an idea regarding the project and want to share with it, do not hesitate to open a new issue.

Contributing

Contributions are welcome. Submit a pull request if you want to apply your changes.

Development

Build

Run

ng build

or

npm run build

or

yarn run build

to build the project. The build artifacts will be stored in the dist/ directory.

Test

You can test the project in three ways by running an appropriate script defined in package.json file.

If you want to run disposable tests, run test script.

In case you want to watch for changes in files being tested, run test-watch script.

Or if you want to debug your code in a browser, run test-debug script.

License

The code is available under the MIT License.

install

npm i ngx-url

Downloadsweekly downloads

2

version

2.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability