如何在域部件之后获得AngularJs路由路径?
例如,如果我有这种url如何在域部件之后获得AngularJs路由路径?,angularjs,angular-ui-router,Angularjs,Angular Ui Router,例如,如果我有这种urllocalhost/About,localhost/Projects,localhost/Photography,我如何在localhost/之后获得值,即关于项目摄影 我已经编写了我的app.js,如下所示: angularSite.config(['$routeProvider', function($routeProvider) { $routeProvider. when('/About', { templateUrl: '
localhost/About
,localhost/Projects
,localhost/Photography
,我如何在localhost/
之后获得值,即关于项目摄影
我已经编写了我的app.js,如下所示:
angularSite.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/About', {
templateUrl: 'partials/about.html',
// controller: 'AboutController'
}).
when('/Projects', {
templateUrl: 'partials/projects.html',
controller: 'WorkController'
}).
when('/Photography', {
templateUrl: 'partials/photo.html',
}).
otherwise({
redirectTo: '/'
});
}]);
如果需要在控制器/服务/指令中获取当前路径,$location.path()
应该这样做(需要插入$location
)