Reputation: 752
I am using angularjs and I want to create a simple registration page. I have used a link, so that when clicking on a link, the user should redirect to registration page.
I have got my index.html page like:
<!DOCTYPE html>
<html>
<head lang="en" np-app="login">
<meta charset="UTF-8">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js" type="text/javascript"></script>
<title>Test</title>
</head>
<body>
<a href="#/partials/register.html">link</a>
</body>
</html>
and app.js like:
angular.module('login', [])
.config(function ($routeProvider,$locationProvider) {
$routeProvider.when('/register',
{
templateUrl: 'partials/register',
controller: RegisterCtrl
});
$routeProvider.when('/private',
{
templateUrl: 'partials/private',
controller: PrivateCtrl
});
$routeProvider.when('/admin',
{
templateUrl: 'partials/admin',
controller: AdminCtrl
});
});
when I click on 'link' hyperlink, it is not redirecting to register page.
My register page is something like:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Register</title>
</head>
<body>
<input type="text"/>
</body>
</html>
Upvotes: 1
Views: 1276
Reputation: 41
If should work if you add target="_self"
to the link. This bypasses angular routing mechanism.
See this thread.
Upvotes: 1
Reputation: 57
try to
templateUrl: 'partials/register.html',
controller: RegisterCtrl
Add .html to your templateUrl
Upvotes: 0