0

In one of my view ther is a link like this with href attribute href = "!#/Program"and i am trinying to match it with below routing,but its giving me no route matches error as "No route matches "/!".

my html code is

<p><a href="!#/Program">Click me</a></p>  

my main.js file

var app = angular.module('app', []);
         app.config(function ($routeProvider,$locationProvider) {
        //$locationProvider.html5Mode(false);
        //$locationProvider.hashPrefix("!") ;
        $routeProvider
    .when('/',
    {
        templateUrl: "app.html",
        controller: "AppCtrl"
    }

)
    .when('/Program' ,
    {   templateUrl: "detail1.html" ,
        controller: "Redirect"
    }
)
    .when('/Program/123456/channel/78458585',

    {
        templateUrl: "details.html" ,
        controller: "Detail"
    }
    )  ;

});

0

1 Answer 1

2

You should just use the path without the bang(!), try this:

<p><a href="#/Program">Click me</a></p>  

If you set $locationProvider.hashPrefix('!');, then you should use #! in stead of !# like this (make sure you have the module $locationProvider injected)

<p><a href="#!/Program">Click me</a></p>  

# is the separator, and the prefix is inserted at the beginning of the # part which is after #.

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.