11

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

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
                   });

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

2
  • Just curious, why do you want to know this ? Commented Nov 10, 2012 at 23:37
  • I'm integrating a CMS solution into my ASP.NET MVC site. The CMS essentially toggles contenteditable on tagged elements in the HTML thats been pulled in by Angular via template pages. Then "publish" sends the new HTML to my C# and it updates the HTML file on the server. But it needs to know which file to update. Simple! Commented Nov 11, 2012 at 9:48

1 Answer 1

24

You're probably looking for $route.current.templateUrl.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.