Reputation: 225
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"
}
) ;
});
Upvotes: 0
Views: 322
Reputation: 54524
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 #
.
Upvotes: 2