AngularJS获得当前templateUrl(HTML页面)页面、AngularJS、templateUrl、HTML

2023-09-13 02:58:46 作者:陪着我等天明

我用AngularJS构建我的应用程序。 NG-视图设置经由routeProvider路由。

I've used AngularJS to build my app. ng-view is set up with routing via the routeProvider.

这一切工作正常,但我想知道我怎么能得到当前templateUrl?

It all works fine but I'd like to know how I can get the current templateUrl?

$routeProvider.
    when('/terms', {
                    templateUrl: '/pages/terms.html',
                    controller: AboutController
                   });

在这种情况下, /pages/terms.html ...

In this case /pages/terms.html...

推荐答案

您可能正在寻找 $ route.current.templateUrl