2016-04-18 11 views
0

私はangularjsを使用してアプリケーションを作成しています。私は答えとして@AvinashRajコメントを貼り付けたURLからURLから特定の文字列を取得

console.log($location.path())// this will gives me `/admin/dashboard` 
+4

'はconsole.log($ location.path()。スプリット( '/')[1])' –

答えて

0

を唯一の管理者が必要

https://localhost:8443/#/admin/dashboard 

:私はここに私のURLで、URLから特定の文字列を必要としています。

これらの基本的な文字列メソッドを使用してください。

$location.path().split('/')[1]; 

OR

$location.path().slice(1,6); 
$location.path().substr(1,5); 
関連する問題