1

I am working on deeplinking in ASP.NET MVC and using Angular JS. I have a doubt regarding that. When we specify Routes in RouteConfig.cs, can we access them outside that file to determine that if user is in deeplink or not? How to build deeplink URL?

I am currently using $rootscope.watch to find the URL. Is there any other better way to do this?

$rootScope.$watch(function (newLocation, oldLocation) {
            if ($rootScope.actualLocation === newLocation.indexOf('/SomeName/Deeplink/') > -1) {
            window.location.reload();
        }});

For example,

  routes.MapRoute("deeplinkurl", "SomeName/Deeplink/{SrcId}/{Id}", 
      new { controller = "SomeName", action = "Index" }, new String[] { "" });

I was thinking of using routeconfig instead of hard-coding the URL so, I would like to use deeplinkurl in js file or cshtml.

Jamie Rees
  • 7,973
  • 2
  • 45
  • 83
Priya Payyavula
  • 387
  • 4
  • 12

0 Answers0