无法在Url中附加html页面名称

时间:2017-08-29 07:21:42

标签: javascript html angularjs

这是我的两个html文件indexAf.html和HomeAF.html。

indexAf.html

<!DOCTYPE html>
<html ng-app="hlfabric">
<head>
<meta charset="ISO-8859-1">
<title>AF Login Page</title>
        <link rel="stylesheet" href="styleAf.css" type="text/css" />
        <script src="lib/angular.min.js"></script>
        <script src="lib/angular-route.min.js"></script>
        <script src="appHLVL.js"></script>
</head>
<body>
    <body ng-controller="AppCtrlAf">
        <div ng-include="template.url"></div>
    </body>
</body>
</html>

HomeAF.html

<!DOCTYPE html>
<html ng-app="hlfabric">
<head>
<meta charset="ISO-8859-1">
<title>AF Login Page</title>
        <link rel="stylesheet" href="styleAf.css" type="text/css" />
        <script src="lib/angular.min.js"></script>
        <script src="lib/angular-route.min.js"></script>
        <script src="appHLVL.js"></script>
</head>
<body>

</body>
</html>

js file

var appHlVl = angular.module('hlfabric', [ 'ngRoute' ]);

appHlVl.controller('AppCtrlAf', function($scope, $rootScope) {
    $scope.templates = [ {
        url : 'LoginAf.html'
    }, {
        url : 'HomeAF.html'
    } ];
    $scope.template = $scope.templates[0];
    $scope.login = function(username, password) {
        if (username === 'AFBlockchain' && password === 'Value12') {
            //authentication.isAuthenticated = true;
            $scope.template = $scope.templates[1];
            $scope.user = username;
        }else{
            $scope.loginError = "Invalid username/password combination";
        }

        ;
    };

});

在从indexAf.html导航到HomeAF.html时,页面正在导航,但网址没有变化(不附加HomeAF.html)而不是indexAf.html。我想在从一个页面导航到另一个页面时更改URL。

0 个答案:

没有答案