href在Angular JS模板中不起作用

时间:2017-04-15 23:36:29

标签: html angularjs

我试图通过使用href导航到不同的页面。 下面是我的html和路由代码。



  function configPaths($routeProvider){

 $routeProvider.
 when('/catalog',{
     templateUrl:'app/views/catalog.tmpl.html',
     controller:'catalogController',
     controllerAs:'catalogCtrl'
 }).
 when('/',{
     templateUrl:'app/views/login.tmpl.html',
     controller:'loginController',
     controllerAs:'lgnCtrl'


 }).
     when('/signup',{
     templateUrl:'app/views/signup.tmpl.html',
     controller:'signUpController',
     controllerAs:'signUpCtrl'
 })

 ;

     }

<div class="container">
    <div class="page-header">Login</div>
<div class="row">
    <div class="col-sm-8 col-xs-offset-2">
        <form name="loginForm" novalidate ng-submit="lgnCtrl.submitDetails()">


            <div  class="form-group" ng-class="{ 'has-error': loginForm.username.$invalid && loginForm.username.$dirty}">
                <label>User Name</label>
                <input type="text" class="form-control" name="username" ng-model="lgnCtrl.user.username" required ng-minlength="4" >
                <div ng-messages="loginForm.username.$error" ng-if="loginForm.username.$dirty">
                    <p class="help-block" ng-message="required">User Name is required</p>
                    <p class="help-block" ng-message="minlength">User Name should be atleast 4 chars</p>
                </div>
            </div>
            <div class="form-group" ng-class="{'has-error':loginForm.password.$invalid && loginForm.password.$dirty}">
                <label>Password</label>
                <input type="password" name="password" class="form-control" ng-model="lgnCtrl.user.password" required ng-minlength="4">
                <div ng-messages="loginForm.password.$error" ng-if="loginForm.password.$dirty">
                    <p class="help-block" ng-message="required">Password is required</p>
                    <p class="help-block" ng-message="minlength">Password should be atleast 4 chars</p>
                </div>
            </div>
            <button type="submit" class="btn btn-primary">Submit</button>
        </form>
    </div>

</div>
    <div class="row">
        <a href="#/signup">Sign Up</a>
    </div>

</div>
&#13;
&#13;
&#13;

有人能告诉我我的代码有什么问题。我想我正确配置了路由信息。

感谢任何帮助。

谢谢

0 个答案:

没有答案