cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get View name?

SOLVED
Highlighted
Amethyst

How to get View name?

Hello friends

 

how is possible to obtain actual View name in JS?

 

thank you for every post.

 

Tomas

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to get View name?

You should be able to use the window.location.hash property to find this, along these lines:

var viewname = window.location.hash.substring(2);

 

2 REPLIES 2

Re: How to get View name?

You should be able to use the window.location.hash property to find this, along these lines:

var viewname = window.location.hash.substring(2);

 

Re: How to get View name?

Hello ClayHelberg

 

Thank you much again. This syntax is exactly what I need.

It works really fine for both -  2D and 3D Views.

 

I tried to put window and window.location to console.log() and I was really suprised how much information I can obtain. This is really inspirative for me.

 

Regards

 

Tomas

 

PS: for the final recap:

/**
* Function return name of active View.
*
* @return (String) - view name.
*/
$scope.getViewName = function() {
var name = window.location.hash.substring(2);
console.log(name);
return name;
}