| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Angular service to get simple methods to manipulate url parts
Demo: http://yllieth.github.io/angular-url-parser/app/index.html
Rails gem: https://github.com/yllieth/angular_url_parser_rails
bower install yllieth/angular-url-parser --save
Once the lib is downloaded, add a reference in your index.html
<script type="application/javascript" src="../bower_components/angular-url-parser/angular-url-parser.js"></script>
In your Gemfile, add the following line:
gem 'angular_url_parser_rails'In your application.js, add the following line:
//= require angular-url-parser
angular
.module('YOUR-ANGULAR-APP-NAME', [
'ngUrlParser'
])
.controller('demoCtrl', function(urlParser) {
this.parts = urlParser.parse();
this.protocol = urlParser.getProtocol();
this.host = urlParser.getHost();
this.hostname = urlParser.getHostname();
this.port = urlParser.getPort();
this.route = urlParser.getRoute();
this.routeAttributes = urlParser.getRouteAttributes();
this.queryString = urlParser.getQuerystring();
this.option = urlParser.getOption();
this.hash = urlParser.getHash();
})// urlParser.parse('http://localhost:3000/models?sort=asc#quantiles')
{
"protocol": "http:",
"host": "localhost:3000",
"hostname": "localhost",
"port": "3000",
"pathname": "/models",
"search": "?sort=asc",
"searchObject": { "sort": "asc" },
"hash": "quantiles"
}| Back | FazBrowse Home | New Git URL |