10 examples of 'get current url in angular' in JavaScript

Every line of 'get current url in angular' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
302function getCurrentPath($scope,$http,path){
303 if(path){
304 var cutLength = ($scope.rootPath).length;
305 var currentPath = path.substring(cutLength,path.length);
306 return currentPath;
307 }else{
308 return "";
309 }
310}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

19function read_current_url()
20{
21 mainwp_current_url = document.location.href.replace( /^.*?\/([^/]*?)\/?$/i, '$1' );
22 return mainwp_current_url;
23}
20get currentUrl () {
21 return this.location.url();
22}
380function getCurrentPath() {
381 return this.selectedSidebarItem ? this.selectedSidebarItem.path : '';
382}
313function goToAngularDetails(params) {
314 return detailRoute + 'OS::Glance::Image/' + params.id;
315}
26function getURL()
27{
28 var url = document.documentURI;
29 var match = url.match(/&u=([^&]+)&/);
30
31 // match == null if not found; if so, return an empty string
32 // instead of what would turn out to be portions of the URI
33 if (!match)
34 return "";
35
36 url = decodeURIComponent(match[1]);
37
38 // If this is a view-source page, then get then real URI of the page
39 if (url.startsWith("view-source:"))
40 url = url.slice(12);
41 return url;
42}
194get currentURL() {
195 return this._dataSource.url;
196}
41public static getPage(url: string): string {
42 let urlParts = url.split('/');
43 return urlParts[(urlParts.length - 1)];
44}
203getPath () {
204 return this.addressbar.value.replace(this.addressbar.origin + this.options.baseUrl, '').split('?')[0]
205}
83function viewUrl (url) {
84 return 'beaker://editor/' + url.slice('dat://'.length)
85}

Related snippets